ramifice 0.6.1__py3-none-any.whl → 0.7.0__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.
- ramifice/__init__.py +2 -1
- ramifice/commons/general.py +9 -9
- ramifice/commons/indexes.py +7 -7
- ramifice/commons/many.py +7 -7
- ramifice/commons/one.py +7 -7
- ramifice/commons/tools.py +0 -1
- ramifice/commons/unit_manager.py +3 -3
- ramifice/fields/bool_field.py +2 -2
- ramifice/fields/choice_float_dyn_field.py +3 -3
- ramifice/fields/choice_float_field.py +3 -3
- ramifice/fields/choice_float_mult_dyn_field.py +3 -3
- ramifice/fields/choice_float_mult_field.py +3 -3
- ramifice/fields/choice_int_dyn_field.py +3 -3
- ramifice/fields/choice_int_field.py +3 -3
- ramifice/fields/choice_int_mult_dyn_field.py +3 -3
- ramifice/fields/choice_int_mult_field.py +3 -3
- ramifice/fields/choice_text_dyn_field.py +3 -3
- ramifice/fields/choice_text_field.py +3 -3
- ramifice/fields/choice_text_mult_dyn_field.py +3 -3
- ramifice/fields/choice_text_mult_field.py +3 -3
- ramifice/fields/color_field.py +3 -3
- ramifice/fields/date_field.py +5 -5
- ramifice/fields/date_time_field.py +5 -5
- ramifice/fields/email_field.py +2 -2
- ramifice/fields/file_field.py +2 -2
- ramifice/fields/float_field.py +2 -2
- ramifice/fields/id_field.py +5 -5
- ramifice/fields/image_field.py +2 -2
- ramifice/fields/integer_field.py +2 -2
- ramifice/fields/ip_field.py +2 -2
- ramifice/fields/password_field.py +6 -5
- ramifice/fields/phone_field.py +2 -2
- ramifice/fields/slug_field.py +2 -2
- ramifice/fields/text_field.py +2 -2
- ramifice/fields/url_field.py +2 -2
- ramifice/models/decorator.py +1 -1
- ramifice/models/model.py +6 -6
- ramifice/paladins/check.py +2 -2
- ramifice/paladins/delete.py +2 -2
- ramifice/paladins/password.py +3 -3
- ramifice/paladins/refrash.py +2 -2
- ramifice/paladins/save.py +2 -2
- ramifice/utils/migration.py +15 -15
- ramifice/utils/mixins/json_converter.py +4 -3
- ramifice/utils/tools.py +1 -1
- {ramifice-0.6.1.dist-info → ramifice-0.7.0.dist-info}/METADATA +4 -3
- ramifice-0.7.0.dist-info/RECORD +84 -0
- ramifice-0.6.1.dist-info/RECORD +0 -84
- /ramifice/utils/{globals.py → constants.py} +0 -0
- {ramifice-0.6.1.dist-info → ramifice-0.7.0.dist-info}/WHEEL +0 -0
- {ramifice-0.6.1.dist-info → ramifice-0.7.0.dist-info}/licenses/LICENSE +0 -0
ramifice/__init__.py
CHANGED
@@ -15,5 +15,6 @@
|
|
15
15
|
"""ORM-like API MongoDB for Python language."""
|
16
16
|
|
17
17
|
from ramifice.models.decorator import model
|
18
|
-
from ramifice.utils import
|
18
|
+
from ramifice.utils import translations
|
19
|
+
from ramifice.utils.migration import MigrationManager
|
19
20
|
from ramifice.utils.unit import Unit
|
ramifice/commons/general.py
CHANGED
@@ -7,7 +7,7 @@ from pymongo.asynchronous.command_cursor import AsyncCommandCursor
|
|
7
7
|
from pymongo.asynchronous.database import AsyncDatabase
|
8
8
|
|
9
9
|
from ramifice.commons.tools import correct_mongo_filter
|
10
|
-
from ramifice.utils import
|
10
|
+
from ramifice.utils import constants, translations
|
11
11
|
|
12
12
|
|
13
13
|
class GeneralMixin:
|
@@ -41,7 +41,7 @@ class GeneralMixin:
|
|
41
41
|
) -> int:
|
42
42
|
"""Gets an estimate of the count of documents in a collection using collection metadata."""
|
43
43
|
# Get collection for current model.
|
44
|
-
collection: AsyncCollection =
|
44
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
45
45
|
#
|
46
46
|
return await collection.estimated_document_count(
|
47
47
|
comment=comment,
|
@@ -58,7 +58,7 @@ class GeneralMixin:
|
|
58
58
|
) -> int:
|
59
59
|
"""Gets an estimate of the count of documents in a collection using collection metadata."""
|
60
60
|
# Get collection for current model.
|
61
|
-
collection: AsyncCollection =
|
61
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
62
62
|
# Correcting filter.
|
63
63
|
if filter is not None:
|
64
64
|
filter = correct_mongo_filter(cls, filter)
|
@@ -81,7 +81,7 @@ class GeneralMixin:
|
|
81
81
|
) -> AsyncCommandCursor:
|
82
82
|
"""Runs an aggregation framework pipeline."""
|
83
83
|
# Get collection for current model.
|
84
|
-
collection: AsyncCollection =
|
84
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
85
85
|
# Correcting filter.
|
86
86
|
if pipeline is not None:
|
87
87
|
pipeline = correct_mongo_filter(cls, pipeline)
|
@@ -109,7 +109,7 @@ class GeneralMixin:
|
|
109
109
|
Returns an array of unique values for specified field of collection.
|
110
110
|
"""
|
111
111
|
# Get collection for current model.
|
112
|
-
collection: AsyncCollection =
|
112
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
113
113
|
# Correcting filter.
|
114
114
|
if filter is not None:
|
115
115
|
filter = correct_mongo_filter(cls, filter)
|
@@ -127,7 +127,7 @@ class GeneralMixin:
|
|
127
127
|
def collection_name(cls) -> str:
|
128
128
|
"""Get collection name."""
|
129
129
|
# Get collection for current model.
|
130
|
-
collection: AsyncCollection =
|
130
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
131
131
|
#
|
132
132
|
return collection.name
|
133
133
|
|
@@ -138,7 +138,7 @@ class GeneralMixin:
|
|
138
138
|
The full name is of the form database_name.collection_name.
|
139
139
|
"""
|
140
140
|
# Get collection for current model.
|
141
|
-
collection: AsyncCollection =
|
141
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
142
142
|
#
|
143
143
|
return collection.full_name
|
144
144
|
|
@@ -146,7 +146,7 @@ class GeneralMixin:
|
|
146
146
|
def database(cls) -> AsyncDatabase:
|
147
147
|
"""Get AsyncBatabase for the current Model."""
|
148
148
|
# Get collection for current model.
|
149
|
-
collection: AsyncCollection =
|
149
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
150
150
|
#
|
151
151
|
return collection.database
|
152
152
|
|
@@ -154,6 +154,6 @@ class GeneralMixin:
|
|
154
154
|
def collection(cls) -> AsyncCollection:
|
155
155
|
"""Get AsyncCollection for the current Model."""
|
156
156
|
# Get collection for current model.
|
157
|
-
collection: AsyncCollection =
|
157
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
158
158
|
#
|
159
159
|
return collection
|
ramifice/commons/indexes.py
CHANGED
@@ -4,7 +4,7 @@ from typing import Any
|
|
4
4
|
|
5
5
|
from pymongo.asynchronous.collection import AsyncCollection
|
6
6
|
|
7
|
-
from ramifice.utils import
|
7
|
+
from ramifice.utils import constants
|
8
8
|
|
9
9
|
|
10
10
|
class IndexMixin:
|
@@ -20,7 +20,7 @@ class IndexMixin:
|
|
20
20
|
) -> str:
|
21
21
|
"""Creates an index on this collection."""
|
22
22
|
# Get collection for current model.
|
23
|
-
collection: AsyncCollection =
|
23
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
24
24
|
# Create index.
|
25
25
|
result: str = await collection.create_index(
|
26
26
|
keys=keys,
|
@@ -40,7 +40,7 @@ class IndexMixin:
|
|
40
40
|
) -> None:
|
41
41
|
"""Drops the specified index on this collection."""
|
42
42
|
# Get collection for current model.
|
43
|
-
collection: AsyncCollection =
|
43
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
44
44
|
# Delete index.
|
45
45
|
await collection.drop_index(
|
46
46
|
index_or_name=index_or_name,
|
@@ -59,7 +59,7 @@ class IndexMixin:
|
|
59
59
|
) -> list[str]:
|
60
60
|
"""Create one or more indexes on this collection."""
|
61
61
|
# Get collection for current model.
|
62
|
-
collection: AsyncCollection =
|
62
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
63
63
|
# Create indexes.
|
64
64
|
result: list[str] = await collection.create_indexes(
|
65
65
|
indexes=indexes,
|
@@ -78,7 +78,7 @@ class IndexMixin:
|
|
78
78
|
) -> None:
|
79
79
|
"""Drops all indexes on this collection."""
|
80
80
|
# Get collection for current model.
|
81
|
-
collection: AsyncCollection =
|
81
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
82
82
|
# Delete indexes.
|
83
83
|
await collection.drop_indexes(session=session, comment=comment, **kwargs)
|
84
84
|
|
@@ -90,7 +90,7 @@ class IndexMixin:
|
|
90
90
|
) -> Any:
|
91
91
|
"""Get information on this collection’s indexes."""
|
92
92
|
# Get collection for current model.
|
93
|
-
collection: AsyncCollection =
|
93
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
94
94
|
# Get information.
|
95
95
|
result = await collection.index_information(session=session, comment=comment)
|
96
96
|
return result
|
@@ -103,7 +103,7 @@ class IndexMixin:
|
|
103
103
|
) -> Any:
|
104
104
|
"""Get a cursor over the index documents for this collection."""
|
105
105
|
# Get collection for current model.
|
106
|
-
collection: AsyncCollection =
|
106
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
107
107
|
# Get cursor.
|
108
108
|
cursor = await collection.list_indexes(session=session, comment=comment)
|
109
109
|
return cursor
|
ramifice/commons/many.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"""Queries like `find many`."""
|
2
2
|
|
3
|
-
import json
|
4
3
|
from typing import Any
|
5
4
|
|
5
|
+
import orjson
|
6
6
|
from pymongo.asynchronous.collection import AsyncCollection
|
7
7
|
from pymongo.asynchronous.cursor import AsyncCursor, CursorType
|
8
8
|
from pymongo.results import DeleteResult
|
@@ -12,7 +12,7 @@ from ramifice.commons.tools import (
|
|
12
12
|
mongo_doc_to_raw_doc,
|
13
13
|
password_to_none,
|
14
14
|
)
|
15
|
-
from ramifice.utils import
|
15
|
+
from ramifice.utils import constants, translations
|
16
16
|
from ramifice.utils.errors import PanicError
|
17
17
|
|
18
18
|
|
@@ -46,7 +46,7 @@ class ManyMixin:
|
|
46
46
|
) -> list[dict[str, Any]]:
|
47
47
|
"""Find documents."""
|
48
48
|
# Get collection for current model.
|
49
|
-
collection: AsyncCollection =
|
49
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
50
50
|
# Correcting filter.
|
51
51
|
if filter is not None:
|
52
52
|
filter = correct_mongo_filter(cls, filter)
|
@@ -114,7 +114,7 @@ class ManyMixin:
|
|
114
114
|
datetime to str
|
115
115
|
"""
|
116
116
|
# Get collection for current model.
|
117
|
-
collection: AsyncCollection =
|
117
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
118
118
|
# Correcting filter.
|
119
119
|
if filter is not None:
|
120
120
|
filter = correct_mongo_filter(cls, filter)
|
@@ -184,7 +184,7 @@ class ManyMixin:
|
|
184
184
|
) -> str | None:
|
185
185
|
"""Find documents and convert to a json string."""
|
186
186
|
# Get collection for current model.
|
187
|
-
collection: AsyncCollection =
|
187
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
188
188
|
# Correcting filter.
|
189
189
|
if filter is not None:
|
190
190
|
filter = correct_mongo_filter(cls, filter)
|
@@ -225,7 +225,7 @@ class ManyMixin:
|
|
225
225
|
lang,
|
226
226
|
)
|
227
227
|
)
|
228
|
-
return
|
228
|
+
return orjson.dumps(doc_list).decode("utf-8") if len(doc_list) > 0 else None
|
229
229
|
|
230
230
|
@classmethod
|
231
231
|
async def delete_many(
|
@@ -247,7 +247,7 @@ class ManyMixin:
|
|
247
247
|
)
|
248
248
|
raise PanicError(msg)
|
249
249
|
# Get collection for current model.
|
250
|
-
collection: AsyncCollection =
|
250
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
251
251
|
# Correcting filter.
|
252
252
|
if filter is not None:
|
253
253
|
filter = correct_mongo_filter(cls, filter)
|
ramifice/commons/one.py
CHANGED
@@ -10,7 +10,7 @@ from ramifice.commons.tools import (
|
|
10
10
|
mongo_doc_to_raw_doc,
|
11
11
|
password_to_none,
|
12
12
|
)
|
13
|
-
from ramifice.utils import
|
13
|
+
from ramifice.utils import constants, translations
|
14
14
|
from ramifice.utils.errors import PanicError
|
15
15
|
|
16
16
|
|
@@ -26,7 +26,7 @@ class OneMixin:
|
|
26
26
|
) -> dict[str, Any] | None:
|
27
27
|
"""Find a single document."""
|
28
28
|
# Get collection for current model.
|
29
|
-
collection: AsyncCollection =
|
29
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
30
30
|
# Correcting filter.
|
31
31
|
if filter is not None:
|
32
32
|
filter = correct_mongo_filter(cls, filter)
|
@@ -48,7 +48,7 @@ class OneMixin:
|
|
48
48
|
) -> dict[str, Any] | None:
|
49
49
|
"""Find a single document and converting to raw document."""
|
50
50
|
# Get collection for current model.
|
51
|
-
collection: AsyncCollection =
|
51
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
52
52
|
# Correcting filter.
|
53
53
|
if filter is not None:
|
54
54
|
filter = correct_mongo_filter(cls, filter)
|
@@ -75,7 +75,7 @@ class OneMixin:
|
|
75
75
|
) -> Any | None:
|
76
76
|
"""Find a single document and convert it to a Model instance."""
|
77
77
|
# Get collection for current model.
|
78
|
-
collection: AsyncCollection =
|
78
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
79
79
|
# Correcting filter.
|
80
80
|
if filter is not None:
|
81
81
|
filter = correct_mongo_filter(cls, filter)
|
@@ -96,7 +96,7 @@ class OneMixin:
|
|
96
96
|
) -> str | None:
|
97
97
|
"""Find a single document and convert it to a JSON string."""
|
98
98
|
# Get collection for current model.
|
99
|
-
collection: AsyncCollection =
|
99
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
100
100
|
# Correcting filter.
|
101
101
|
if filter is not None:
|
102
102
|
filter = correct_mongo_filter(cls, filter)
|
@@ -129,7 +129,7 @@ class OneMixin:
|
|
129
129
|
)
|
130
130
|
raise PanicError(msg)
|
131
131
|
# Get collection for current model.
|
132
|
-
collection: AsyncCollection =
|
132
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
133
133
|
# Correcting filter.
|
134
134
|
if filter is not None:
|
135
135
|
filter = correct_mongo_filter(cls, filter)
|
@@ -166,7 +166,7 @@ class OneMixin:
|
|
166
166
|
)
|
167
167
|
raise PanicError(msg)
|
168
168
|
# Get collection for current model.
|
169
|
-
collection: AsyncCollection =
|
169
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
170
170
|
# Correcting filter.
|
171
171
|
if filter is not None:
|
172
172
|
filter = correct_mongo_filter(cls, filter)
|
ramifice/commons/tools.py
CHANGED
ramifice/commons/unit_manager.py
CHANGED
@@ -7,7 +7,7 @@ from typing import Any
|
|
7
7
|
|
8
8
|
from pymongo.asynchronous.collection import AsyncCollection
|
9
9
|
|
10
|
-
from ramifice.utils import
|
10
|
+
from ramifice.utils import constants, translations
|
11
11
|
from ramifice.utils.errors import PanicError
|
12
12
|
from ramifice.utils.unit import Unit
|
13
13
|
|
@@ -26,7 +26,7 @@ class UnitMixin:
|
|
26
26
|
"""
|
27
27
|
# Get access to super collection.
|
28
28
|
# (Contains Model state and dynamic field data.)
|
29
|
-
super_collection: AsyncCollection =
|
29
|
+
super_collection: AsyncCollection = constants.MONGO_DATABASE[constants.SUPER_COLLECTION_NAME]
|
30
30
|
# Get Model state.
|
31
31
|
model_state: dict[str, Any] | None = await super_collection.find_one(
|
32
32
|
filter={"collection_name": cls.META["collection_name"]}
|
@@ -89,7 +89,7 @@ class UnitMixin:
|
|
89
89
|
cls.META["data_dynamic_fields"][unit_field] = choices or None
|
90
90
|
# Update documents in the collection of the current Model.
|
91
91
|
if unit.is_delete:
|
92
|
-
collection: AsyncCollection =
|
92
|
+
collection: AsyncCollection = constants.MONGO_DATABASE[cls.META["collection_name"]]
|
93
93
|
async for mongo_doc in collection.find():
|
94
94
|
field_value = mongo_doc[unit_field]
|
95
95
|
if field_value is not None:
|
ramifice/fields/bool_field.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"""Field of Model for enter boolean value."""
|
2
2
|
|
3
3
|
from ramifice.fields.general.field import Field
|
4
|
-
from ramifice.utils import
|
4
|
+
from ramifice.utils import constants
|
5
5
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
6
6
|
|
7
7
|
|
@@ -18,7 +18,7 @@ class BooleanField(Field, JsonMixin):
|
|
18
18
|
warning: list[str] | None = None,
|
19
19
|
default: bool = False,
|
20
20
|
):
|
21
|
-
if
|
21
|
+
if constants.DEBUG:
|
22
22
|
if default is not None and not isinstance(default, bool):
|
23
23
|
raise AssertionError("Parameter `default` - Not а `bool` type!")
|
24
24
|
if not isinstance(label, str):
|
@@ -5,7 +5,7 @@ Type of selective float field with dynamic addition of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -28,7 +28,7 @@ class ChoiceFloatDynField(Field, ChoiceGroup, JsonMixin):
|
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
30
|
):
|
31
|
-
if
|
31
|
+
if constants.DEBUG:
|
32
32
|
if not isinstance(label, str):
|
33
33
|
raise AssertionError("Parameter `default` - Not а `str` type!")
|
34
34
|
if not isinstance(disabled, bool):
|
@@ -67,7 +67,7 @@ class ChoiceFloatDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: float | None = None
|
70
|
-
self.choices: list[
|
70
|
+
self.choices: list[list[float | str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -5,7 +5,7 @@ Type of selective float field with static of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -27,7 +27,7 @@ class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: float | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices: list[
|
30
|
+
choices: list[list[float | str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -51,7 +51,7 @@ class ChoiceFloatField(Field, ChoiceGroup, JsonMixin):
|
|
51
51
|
self.default = default
|
52
52
|
self.choices = choices
|
53
53
|
|
54
|
-
if
|
54
|
+
if constants.DEBUG:
|
55
55
|
if choices is not None:
|
56
56
|
if not isinstance(choices, list):
|
57
57
|
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
@@ -5,7 +5,7 @@ Type of selective float field with dynamic addition of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -27,7 +27,7 @@ class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
required: bool = False,
|
28
28
|
readonly: bool = False,
|
29
29
|
):
|
30
|
-
if
|
30
|
+
if constants.DEBUG:
|
31
31
|
if not isinstance(label, str):
|
32
32
|
raise AssertionError("Parameter `default` - Not а `str` type!")
|
33
33
|
if not isinstance(disabled, bool):
|
@@ -67,7 +67,7 @@ class ChoiceFloatMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: list[float] | None = None
|
70
|
-
self.choices: list[
|
70
|
+
self.choices: list[list[float | str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -5,7 +5,7 @@ Type of selective float field with static of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -27,7 +27,7 @@ class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: list[float] | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices: list[
|
30
|
+
choices: list[list[float | str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -52,7 +52,7 @@ class ChoiceFloatMultField(Field, ChoiceGroup, JsonMixin):
|
|
52
52
|
self.default = default
|
53
53
|
self.choices = choices
|
54
54
|
|
55
|
-
if
|
55
|
+
if constants.DEBUG:
|
56
56
|
if choices is not None:
|
57
57
|
if not isinstance(choices, list):
|
58
58
|
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
@@ -5,7 +5,7 @@ Type of selective integer field with dynamic addition of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -28,7 +28,7 @@ class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
|
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
30
|
):
|
31
|
-
if
|
31
|
+
if constants.DEBUG:
|
32
32
|
if not isinstance(label, str):
|
33
33
|
raise AssertionError("Parameter `default` - Not а `str` type!")
|
34
34
|
if not isinstance(disabled, bool):
|
@@ -67,7 +67,7 @@ class ChoiceIntDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: int | None = None
|
70
|
-
self.choices: list[
|
70
|
+
self.choices: list[list[int | str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -5,7 +5,7 @@ Type of selective integer field with static of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -27,7 +27,7 @@ class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: int | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices: list[
|
30
|
+
choices: list[list[int | str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -51,7 +51,7 @@ class ChoiceIntField(Field, ChoiceGroup, JsonMixin):
|
|
51
51
|
self.default = default
|
52
52
|
self.choices = choices
|
53
53
|
|
54
|
-
if
|
54
|
+
if constants.DEBUG:
|
55
55
|
if choices is not None:
|
56
56
|
if not isinstance(choices, list):
|
57
57
|
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
@@ -5,7 +5,7 @@ Type of selective integer field with dynamic addition of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -27,7 +27,7 @@ class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
required: bool = False,
|
28
28
|
readonly: bool = False,
|
29
29
|
):
|
30
|
-
if
|
30
|
+
if constants.DEBUG:
|
31
31
|
if not isinstance(label, str):
|
32
32
|
raise AssertionError("Parameter `default` - Not а `str` type!")
|
33
33
|
if not isinstance(disabled, bool):
|
@@ -67,7 +67,7 @@ class ChoiceIntMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: list[int] | None = None
|
70
|
-
self.choices: list[
|
70
|
+
self.choices: list[list[int | str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -5,7 +5,7 @@ Type of selective integer field with static of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -27,7 +27,7 @@ class ChoiceIntMultField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: list[int] | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices: list[
|
30
|
+
choices: list[list[int | str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -52,7 +52,7 @@ class ChoiceIntMultField(Field, ChoiceGroup, JsonMixin):
|
|
52
52
|
self.default = default
|
53
53
|
self.choices = choices
|
54
54
|
|
55
|
-
if
|
55
|
+
if constants.DEBUG:
|
56
56
|
if choices is not None:
|
57
57
|
if not isinstance(choices, list):
|
58
58
|
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
@@ -5,7 +5,7 @@ Type of selective text field with dynamic addition of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -28,7 +28,7 @@ class ChoiceTextDynField(Field, ChoiceGroup, JsonMixin):
|
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
30
|
):
|
31
|
-
if
|
31
|
+
if constants.DEBUG:
|
32
32
|
if not isinstance(label, str):
|
33
33
|
raise AssertionError("Parameter `default` - Not а `str` type!")
|
34
34
|
if not isinstance(disabled, bool):
|
@@ -67,7 +67,7 @@ class ChoiceTextDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: str | None = None
|
70
|
-
self.choices: list[
|
70
|
+
self.choices: list[list[str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -5,7 +5,7 @@ Type of selective text field with static of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -27,7 +27,7 @@ class ChoiceTextField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: str | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices: list[
|
30
|
+
choices: list[list[str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -51,7 +51,7 @@ class ChoiceTextField(Field, ChoiceGroup, JsonMixin):
|
|
51
51
|
self.default = default
|
52
52
|
self.choices = choices
|
53
53
|
|
54
|
-
if
|
54
|
+
if constants.DEBUG:
|
55
55
|
if choices is not None:
|
56
56
|
if not isinstance(choices, list):
|
57
57
|
raise AssertionError("Parameter `choices` - Not а `list` type!")
|
@@ -5,7 +5,7 @@ Type of selective text field with dynamic addition of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -27,7 +27,7 @@ class ChoiceTextMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
required: bool = False,
|
28
28
|
readonly: bool = False,
|
29
29
|
):
|
30
|
-
if
|
30
|
+
if constants.DEBUG:
|
31
31
|
if not isinstance(label, str):
|
32
32
|
raise AssertionError("Parameter `default` - Not а `str` type!")
|
33
33
|
if not isinstance(disabled, bool):
|
@@ -67,7 +67,7 @@ class ChoiceTextMultDynField(Field, ChoiceGroup, JsonMixin):
|
|
67
67
|
JsonMixin.__init__(self)
|
68
68
|
|
69
69
|
self.value: list[str] | None = None
|
70
|
-
self.choices: list[
|
70
|
+
self.choices: list[list[str]] | None = None
|
71
71
|
|
72
72
|
def has_value(self, is_migrate: bool = False) -> bool:
|
73
73
|
"""Does the field value match the possible options in choices."""
|
@@ -5,7 +5,7 @@ Type of selective text field with static of elements.
|
|
5
5
|
|
6
6
|
from ramifice.fields.general.choice_group import ChoiceGroup
|
7
7
|
from ramifice.fields.general.field import Field
|
8
|
-
from ramifice.utils import
|
8
|
+
from ramifice.utils import constants
|
9
9
|
from ramifice.utils.mixins.json_converter import JsonMixin
|
10
10
|
|
11
11
|
|
@@ -27,7 +27,7 @@ class ChoiceTextMultField(Field, ChoiceGroup, JsonMixin):
|
|
27
27
|
default: list[str] | None = None,
|
28
28
|
required: bool = False,
|
29
29
|
readonly: bool = False,
|
30
|
-
choices: list[
|
30
|
+
choices: list[list[str]] | None = None,
|
31
31
|
):
|
32
32
|
Field.__init__(
|
33
33
|
self,
|
@@ -52,7 +52,7 @@ class ChoiceTextMultField(Field, ChoiceGroup, JsonMixin):
|
|
52
52
|
self.default = default
|
53
53
|
self.choices = choices
|
54
54
|
|
55
|
-
if
|
55
|
+
if constants.DEBUG:
|
56
56
|
if choices is not None:
|
57
57
|
if not isinstance(choices, list):
|
58
58
|
raise AssertionError("Parameter `choices` - Not а `list` type!")
|