cs-models 0.0.667__py3-none-any.whl → 0.0.669__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.
Potentially problematic release.
This version of cs-models might be problematic. Click here for more details.
- cs_models/resources/Workbook/schemas.py +8 -0
- cs_models/resources/WorkbookBlock/schemas.py +48 -1
- {cs_models-0.0.667.dist-info → cs_models-0.0.669.dist-info}/METADATA +1 -1
- {cs_models-0.0.667.dist-info → cs_models-0.0.669.dist-info}/RECORD +6 -6
- {cs_models-0.0.667.dist-info → cs_models-0.0.669.dist-info}/WHEEL +0 -0
- {cs_models-0.0.667.dist-info → cs_models-0.0.669.dist-info}/top_level.txt +0 -0
|
@@ -3,6 +3,9 @@ from marshmallow import (
|
|
|
3
3
|
fields,
|
|
4
4
|
validate,
|
|
5
5
|
)
|
|
6
|
+
from ..WorkbookBlock.schemas import (
|
|
7
|
+
WorkbookBlockResourceSchema,
|
|
8
|
+
)
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
class WorkbookResourceSchema(Schema):
|
|
@@ -11,6 +14,11 @@ class WorkbookResourceSchema(Schema):
|
|
|
11
14
|
id = fields.Integer(dump_only=True)
|
|
12
15
|
user_id = fields.String(required=True, validate=not_blank)
|
|
13
16
|
workbook_name = fields.String(required=True)
|
|
17
|
+
blocks = fields.Nested(
|
|
18
|
+
WorkbookBlockResourceSchema(exclude=("workbook_id",)),
|
|
19
|
+
many=True,
|
|
20
|
+
dump_only=True,
|
|
21
|
+
)
|
|
14
22
|
is_deleted = fields.Boolean(allow_none=True)
|
|
15
23
|
created_at = fields.DateTime(required=True)
|
|
16
24
|
updated_at = fields.DateTime(dump_only=True)
|
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
"""Marshmallow Schema for AssistantCommand."""
|
|
2
|
+
import json
|
|
2
3
|
from marshmallow import Schema, fields
|
|
4
|
+
from ..WorkbookBlockComment.schemas import (
|
|
5
|
+
WorkbookBlockCommentResourceSchema,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class WorkbookBlockDataField(fields.Field):
|
|
10
|
+
"""Field that stores result for the Assistant command."""
|
|
11
|
+
|
|
12
|
+
def _serialize(self, value, attr, obj, **kwargs):
|
|
13
|
+
"""
|
|
14
|
+
In the DB, the `result` field is a text field. We persist
|
|
15
|
+
data by performing the following:
|
|
16
|
+
|
|
17
|
+
AssistantCommandModel(
|
|
18
|
+
...
|
|
19
|
+
result=json.dumps({...}),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
So here we need to perform the inverse operation (i.e `json.loads(..)`)
|
|
23
|
+
"""
|
|
24
|
+
if value is None:
|
|
25
|
+
return None
|
|
26
|
+
return json.loads(value)
|
|
27
|
+
|
|
28
|
+
def _deserialize(self, value, attr, data, **kwargs):
|
|
29
|
+
"""
|
|
30
|
+
In the DB, the `result` field is a text field. We persist
|
|
31
|
+
data by performing the following:
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
AssistantCommandModel(
|
|
36
|
+
***AssistantCommandResourceSchema().load({
|
|
37
|
+
...
|
|
38
|
+
"result": [{"some_key": 1}, {"some_key": 2}],
|
|
39
|
+
}),
|
|
40
|
+
)
|
|
41
|
+
"""
|
|
42
|
+
if value is None:
|
|
43
|
+
return None
|
|
44
|
+
return json.dumps(value)
|
|
3
45
|
|
|
4
46
|
|
|
5
47
|
class WorkbookBlockResourceSchema(Schema):
|
|
@@ -9,7 +51,12 @@ class WorkbookBlockResourceSchema(Schema):
|
|
|
9
51
|
workbook_id = fields.Integer(required=True)
|
|
10
52
|
sequence_number = fields.Integer(required=True)
|
|
11
53
|
block_type = fields.String(required=True)
|
|
12
|
-
block_data =
|
|
54
|
+
block_data = WorkbookBlockDataField(required=True, allow_none=True)
|
|
55
|
+
comments = fields.Nested(
|
|
56
|
+
WorkbookBlockCommentResourceSchema(exclude=("block_id",)),
|
|
57
|
+
many=True,
|
|
58
|
+
dump_only=True,
|
|
59
|
+
)
|
|
13
60
|
is_deleted = fields.Boolean(allow_none=True)
|
|
14
61
|
created_at = fields.DateTime(dump_only=True)
|
|
15
62
|
updated_at = fields.DateTime(dump_only=True)
|
|
@@ -1052,10 +1052,10 @@ cs_models/resources/Watchlist/models.py,sha256=YpuJCjfZvgtK_uHJieJGAyIeC-B1Zxb-w
|
|
|
1052
1052
|
cs_models/resources/Watchlist/schemas.py,sha256=2VLCMjiOA73pp_mtjo9kmWpgpOuXOCmlSQNwe39s8qw,1818
|
|
1053
1053
|
cs_models/resources/Workbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1054
1054
|
cs_models/resources/Workbook/models.py,sha256=6sj9VhKTCnBL32_pkwUqfE9ESBRu1oCL2cpQn7bxlv8,822
|
|
1055
|
-
cs_models/resources/Workbook/schemas.py,sha256=
|
|
1055
|
+
cs_models/resources/Workbook/schemas.py,sha256=xcNoPzHK6ER06XA3fAvX3x7VtX47aBP0vrIqiJvUVKw,688
|
|
1056
1056
|
cs_models/resources/WorkbookBlock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1057
1057
|
cs_models/resources/WorkbookBlock/models.py,sha256=tYxYRt6210QdvgUldtmy3p3-srlVuEBZU2yCT01Xnag,1467
|
|
1058
|
-
cs_models/resources/WorkbookBlock/schemas.py,sha256=
|
|
1058
|
+
cs_models/resources/WorkbookBlock/schemas.py,sha256=CfjGkuRff_ohR4WNSRKYkwpIrwPBvfuK9o21lNU3sWM,1859
|
|
1059
1059
|
cs_models/resources/WorkbookBlockComment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1060
1060
|
cs_models/resources/WorkbookBlockComment/models.py,sha256=t1dLdweoPOzld1uBqrGJ3rrr66UkMwdiplNZEA1WtPU,1251
|
|
1061
1061
|
cs_models/resources/WorkbookBlockComment/schemas.py,sha256=9UI_mTuPBYBk5qKUC2u0oR_clHA9XZ-bh5hhr24E-vs,563
|
|
@@ -1105,7 +1105,7 @@ cs_models/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
1105
1105
|
cs_models/utils/alchemy.py,sha256=fhINGFn41owJ2DLXQKXAAtLqeZ1BRzD_qU0wPK_bsGQ,1598
|
|
1106
1106
|
cs_models/utils/utils.py,sha256=bY623DuzycfPQiaOQT2AxfANeWfwr5w76dBuQ813-ns,3664
|
|
1107
1107
|
cs_models/utils/profiling/__init__.py,sha256=N-73vb0M92C975fxgXyBCBjCPELl8Oh21ZY_-tzDnns,569
|
|
1108
|
-
cs_models-0.0.
|
|
1109
|
-
cs_models-0.0.
|
|
1110
|
-
cs_models-0.0.
|
|
1111
|
-
cs_models-0.0.
|
|
1108
|
+
cs_models-0.0.669.dist-info/METADATA,sha256=fUuZ7WjCpptkNy9CeIuG7goNdBkeFiWHXreJsy908xc,792
|
|
1109
|
+
cs_models-0.0.669.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
1110
|
+
cs_models-0.0.669.dist-info/top_level.txt,sha256=M7CA8Nh5t0vRManQ9gHfphhO16uhMqIbfaxr1jPDg18,10
|
|
1111
|
+
cs_models-0.0.669.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|