cs-models 0.0.711__py3-none-any.whl → 0.0.712__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.

@@ -24,6 +24,7 @@ class TableFigureModel(Base):
24
24
  )
25
25
  source_type = Column(String(50), nullable=False)
26
26
  source_id = Column(Integer, nullable=False)
27
+ type = Column(String(50), nullable=False)
27
28
  label = Column(String(50), nullable=True)
28
29
  caption = Column(Text, nullable=True)
29
30
  description = Column(Text, nullable=True)
@@ -1,3 +1,4 @@
1
+ import json
1
2
  from marshmallow import (
2
3
  Schema,
3
4
  fields,
@@ -5,6 +6,44 @@ from marshmallow import (
5
6
  )
6
7
 
7
8
 
9
+ class TableFigureCaptionField(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)
45
+
46
+
8
47
  class TableFigureResourceSchema(Schema):
9
48
  not_blank = validate.Length(min=1, error='Field cannot be blank')
10
49
 
@@ -12,8 +51,9 @@ class TableFigureResourceSchema(Schema):
12
51
  file_id = fields.Integer(required=True)
13
52
  source_type = fields.String(required=True)
14
53
  source_id = fields.Integer(required=True)
54
+ type = fields.String(required=True)
15
55
  label = fields.String(allow_none=True)
16
- caption = fields.String(allow_none=True)
56
+ caption = TableFigureCaptionField(required=True, allow_none=True)
17
57
  description = fields.String(allow_none=True)
18
58
  content = fields.String(allow_none=True)
19
59
  link = fields.String(allow_none=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cs-models
3
- Version: 0.0.711
3
+ Version: 0.0.712
4
4
  Summary: MySQL db models
5
5
  Home-page: https://github.com/mindgram/cs-models
6
6
  Author: Shrey Verma
@@ -905,8 +905,8 @@ cs_models/resources/SubsidiarySponsorMapping/models.py,sha256=nzTbV96Dy25NmvFrWz
905
905
  cs_models/resources/SubsidiarySponsorMapping/schemas.py,sha256=RjiN4h8HMKsaGRVGWHrO_LdH6A5zzl2WfieEJJQv7I8,813
906
906
  cs_models/resources/SubsidiarySponsorMapping/test_subsidiary_sponsor_mapping.py,sha256=vMCJDohlOdZaUxMuAnqRy6hEUepc_EE-6nVElM8WUtY,5977
907
907
  cs_models/resources/TableFigure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
908
- cs_models/resources/TableFigure/models.py,sha256=9QDvBIetzIrJFtCFx8E6azow5n62vTxD0vsNR0X8EKc,1036
909
- cs_models/resources/TableFigure/schemas.py,sha256=VGt0vS84l8IXFG_qwbbCGZ-zqi8EhcqIixlCVCVv1z0,668
908
+ cs_models/resources/TableFigure/models.py,sha256=RXuqM4BGzwuykCYrKNc1gkmtjvyftbp7gkUayX5UU00,1082
909
+ cs_models/resources/TableFigure/schemas.py,sha256=sY7mElYRzVd8bzrPONQ4UL2C44z-Eckl-6ypFoNdDBI,1771
910
910
  cs_models/resources/TableOutbox/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
911
911
  cs_models/resources/TableOutbox/models.py,sha256=NAq51yqxx4tRWsIoPKSOhRXkAAX0Yom7146qOJ4fX5E,837
912
912
  cs_models/resources/TableOutbox/schemas.py,sha256=zTR8wSwu9YSgsZX2CH7wPi-toGAkJDAQMPcYwBzWX8g,546
@@ -1180,7 +1180,7 @@ cs_models/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1180
1180
  cs_models/utils/alchemy.py,sha256=fhINGFn41owJ2DLXQKXAAtLqeZ1BRzD_qU0wPK_bsGQ,1598
1181
1181
  cs_models/utils/utils.py,sha256=bY623DuzycfPQiaOQT2AxfANeWfwr5w76dBuQ813-ns,3664
1182
1182
  cs_models/utils/profiling/__init__.py,sha256=N-73vb0M92C975fxgXyBCBjCPELl8Oh21ZY_-tzDnns,569
1183
- cs_models-0.0.711.dist-info/METADATA,sha256=H_NAj3yw_vLGGNQC9_TlqA0MJwgZZ-6deExEdxNzuLo,792
1184
- cs_models-0.0.711.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
1185
- cs_models-0.0.711.dist-info/top_level.txt,sha256=M7CA8Nh5t0vRManQ9gHfphhO16uhMqIbfaxr1jPDg18,10
1186
- cs_models-0.0.711.dist-info/RECORD,,
1183
+ cs_models-0.0.712.dist-info/METADATA,sha256=SE19aQggkcjEZzp9-uOQ1t31kvdAB21pzcwZdgY0oho,792
1184
+ cs_models-0.0.712.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
1185
+ cs_models-0.0.712.dist-info/top_level.txt,sha256=M7CA8Nh5t0vRManQ9gHfphhO16uhMqIbfaxr1jPDg18,10
1186
+ cs_models-0.0.712.dist-info/RECORD,,