wizata-dsapi 1.2.6__py3-none-any.whl → 1.2.7__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.
wizata_dsapi/__init__.py CHANGED
@@ -18,7 +18,7 @@ from .group_system import GroupSystem
18
18
  from .bucket import Bucket
19
19
 
20
20
  # Sql Entities (Dto)
21
- from .twin import Twin, TwinBlockType
21
+ from .twin import Twin, TwinBlockType, TwinType
22
22
  from .datapoint import DataPoint, BusinessType, Label, Unit, Category, InputModeType
23
23
  from .datastore import DataStore
24
24
  from .insight import Insight
@@ -14,7 +14,7 @@ from .solution_component import SolutionComponent
14
14
  from .business_label import BusinessLabel
15
15
  from .twinregistration import TwinRegistration, TwinRegistrationProperty
16
16
  from .trigger import Trigger
17
- from .twin import Twin
17
+ from .twin import Twin, TwinType
18
18
  from .pipeline import Pipeline
19
19
  from .pipeline_image import PipelineImage
20
20
  from .insight import Insight
@@ -147,5 +147,11 @@ _registry = {
147
147
  "class": Twin,
148
148
  "cloud_dsapi": ['lists', 'get_by_id', 'get_by_key', 'create', 'update', 'delete', 'search'],
149
149
  "cloud_context": ['get_by_id', 'get_by_key', 'create', 'update', 'delete', 'search']
150
+ },
151
+ "twintypes":
152
+ {
153
+ "class": TwinType,
154
+ "cloud_dsapi": [ 'get_by_id', 'create', 'update', 'delete'],
155
+ "cloud_context": [ 'get_by_id', 'create', 'update', 'delete' ]
150
156
  }
151
157
  }
wizata_dsapi/twin.py CHANGED
@@ -13,8 +13,96 @@ def is_valid_hex_color(color):
13
13
  return True
14
14
 
15
15
 
16
+ class TwinType(ApiDto):
17
+ """
18
+ twin type
19
+ """
20
+
21
+ @classmethod
22
+ def route(cls):
23
+ return "twintypes"
24
+
25
+ @classmethod
26
+ def from_dict(cls, data):
27
+ obj = TwinType()
28
+ obj.from_json(data)
29
+ return obj
30
+
31
+ def __init__(self,
32
+ twin_type_id: uuid.UUID = None,
33
+ name: str = None,
34
+ icon: str = None,
35
+ color: str = None,
36
+ description: str = None):
37
+ if twin_type_id is None:
38
+ self.twin_type_id = uuid.uuid4()
39
+ else:
40
+ self.twin_type_id = twin_type_id
41
+ self.name = name
42
+ self.icon = icon
43
+ self.color = color
44
+ if color is not None:
45
+ is_valid_hex_color(color)
46
+ self.description = description
47
+ self.createdById = None
48
+ self.createdDate = None
49
+ self.updatedById = None
50
+ self.updatedDate = None
51
+
52
+ def api_id(self) -> str:
53
+ return str(self.twin_type_id).upper()
54
+
55
+ def endpoint(self) -> str:
56
+ return "TwinTypes"
57
+
58
+ def from_json(self, obj):
59
+ if "id" in obj.keys():
60
+ self.twin_type_id = uuid.UUID(obj["id"])
61
+ if "name" in obj.keys() and obj["name"] is not None:
62
+ self.name = obj["name"]
63
+ if "color" in obj.keys() and obj["color"] is not None:
64
+ is_valid_hex_color(str(obj["color"]))
65
+ self.color = str(obj["color"])
66
+ if "icon" in obj.keys() and obj["icon"] is not None:
67
+ self.icon = str(obj["icon"])
68
+ if "description" in obj.keys() and obj["description"] is not None:
69
+ self.description = str(obj["description"])
70
+ if "createdById" in obj.keys() and obj["createdById"] is not None:
71
+ self.createdById = obj["createdById"]
72
+ if "createdDate" in obj.keys() and obj["createdDate"] is not None:
73
+ self.createdDate = obj["createdDate"]
74
+ if "updatedById" in obj.keys() and obj["updatedById"] is not None:
75
+ self.updatedById = obj["updatedById"]
76
+ if "updatedDate" in obj.keys() and obj["updatedDate"] is not None:
77
+ self.updatedDate = obj["updatedDate"]
78
+
79
+ def to_json(self, target: str = None):
80
+ obj = {
81
+ "id": str(self.twin_type_id)
82
+ }
83
+ if self.name is not None:
84
+ obj["name"] = str(self.name)
85
+ if self.color is not None:
86
+ obj["color"] = str(self.color)
87
+ if self.description is not None:
88
+ obj["description"] = str(self.description)
89
+ if self.icon is not None:
90
+ obj["icon"] = str(self.icon)
91
+ if self.createdById is not None:
92
+ obj["createdById"] = str(self.createdById)
93
+ if self.createdDate is not None:
94
+ obj["createdDate"] = str(self.createdDate)
95
+ if self.updatedById is not None:
96
+ obj["updatedById"] = str(self.updatedById)
97
+ if self.updatedDate is not None:
98
+ obj["updatedDate"] = str(self.updatedDate)
99
+ return obj
100
+
101
+
102
+
16
103
  class TwinBlockType(Enum):
17
104
  """
105
+ deprecated - replaced by TwinType
18
106
  digital twin block type
19
107
  - area
20
108
  - machine
@@ -59,6 +147,7 @@ class Twin(ApiDto):
59
147
  return obj
60
148
 
61
149
  def __init__(self, twin_id=None, hardware_id=None, name=None, parent_id=None, ttype=TwinBlockType.MACHINE,
150
+ type_id:uuid.UUID = None,
62
151
  latitude_id: uuid.UUID = None, longitude_id: uuid.UUID = None, color: str = None, icon: str = None,
63
152
  latitude: float = None, longitude: float = None, description: str = None):
64
153
  if twin_id is None:
@@ -69,6 +158,7 @@ class Twin(ApiDto):
69
158
  self.name = name
70
159
  self.parent_id = parent_id
71
160
  self.type = ttype
161
+ self.type_id = type_id
72
162
  self.description = description
73
163
  self.latitude = latitude
74
164
  self.longitude = longitude
@@ -98,6 +188,8 @@ class Twin(ApiDto):
98
188
  self.name = obj["name"]
99
189
  if "parentId" in obj.keys() and obj["parentId"] is not None:
100
190
  self.parent_id = uuid.UUID(obj["parentId"])
191
+ if "twinTypeId" in obj.keys() and obj["twinTypeId"] is not None:
192
+ self.type_id = uuid.UUID(obj["twinTypeId"])
101
193
  if "latitude" in obj.keys() and obj["latitude"] is not None:
102
194
  self.latitude = float(obj["latitude"])
103
195
  if "longitude" in obj.keys() and obj["longitude"] is not None:
@@ -134,6 +226,8 @@ class Twin(ApiDto):
134
226
  obj["name"] = str(self.name)
135
227
  if self.parent_id is not None:
136
228
  obj["parentId"] = str(self.parent_id)
229
+ if self.type_id is not None:
230
+ obj["twinTypeId"] = str(self.type_id)
137
231
  if self.type is not None and isinstance(self.type, TwinBlockType):
138
232
  obj["type"] = self.type.value
139
233
  if self.color is not None:
wizata_dsapi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.2.6"
1
+ __version__ = "1.2.7"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wizata-dsapi
3
- Version: 1.2.6
3
+ Version: 1.2.7
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -1,5 +1,5 @@
1
- wizata_dsapi/__init__.py,sha256=rXiNoTi7YeObXCa4nLOdILZhhmt_GL2_eIQ5TK5NNlw,2000
2
- wizata_dsapi/api_config.py,sha256=CkEmEZYNKqtnzZRHH5O4QW3O4MtoOJHoghh7ZsOokEc,5073
1
+ wizata_dsapi/__init__.py,sha256=4J-4ssj9oyI_5vv2_vMOR5ZFYQxrcHrmv900KOQEFYY,2010
2
+ wizata_dsapi/api_config.py,sha256=pyGPyoCrfOFl-C6DlDRdQbQWDG2Y_oB4gvzjh2wYb8w,5300
3
3
  wizata_dsapi/api_dto.py,sha256=-NdaTRvw5jW5xFGpIhY8U0-SdvzW2t6QD26y0UPApU0,2238
4
4
  wizata_dsapi/api_interface.py,sha256=DURk-0ey16T8sV5e2Y2G_YybPEusJvZuY0oD5L7AnXo,10903
5
5
  wizata_dsapi/bucket.py,sha256=Zz9olv-pymikAutGitSuGWrAPiawOTW86JDDHG4ugTc,1150
@@ -29,9 +29,9 @@ wizata_dsapi/solution_component.py,sha256=8gbZWx2h_xUqI_pAXa3goqAnR5Y-GDMii8MeGl
29
29
  wizata_dsapi/streamlit_utils.py,sha256=sXBdygktbixV828Zg01Nl27_a4F8zGFc4RY0C8g-1bc,1942
30
30
  wizata_dsapi/template.py,sha256=h2f3dLduJ4WhreVxJXuFIB3pinnI3c39WxBms0bCgos,13007
31
31
  wizata_dsapi/trigger.py,sha256=w3BZYP-L3SUwvaT0oCTanh_Ewn57peZvlt7vxzHv9J8,5129
32
- wizata_dsapi/twin.py,sha256=OFDFg2CsTxOUOVOf6kkDUEK9A3ED7yuPpN9TqodGruo,6581
32
+ wizata_dsapi/twin.py,sha256=LXlX4kUl7JzONyXsuyHfcEFcXvo5ne0PGJfHfK4bXEc,9895
33
33
  wizata_dsapi/twinregistration.py,sha256=Mi6-YuwroiEXc0c1hgrOaphh4hNVoHupxOnXedVtJtE,13377
34
- wizata_dsapi/version.py,sha256=vMQK58X8_YZGKzRm0ThvPAKFtpfyejGmUnDrY9RQ13w,22
34
+ wizata_dsapi/version.py,sha256=49prCLbE3fFzLfxem5rd2dr1iV4_L-bN0N4J7jxU5yA,22
35
35
  wizata_dsapi/wizard_function.py,sha256=RbM7W7Gf-6Rhp_1dU9DBYkHaciknGAGvuAndhAS_vyo,942
36
36
  wizata_dsapi/wizard_request.py,sha256=v6BaqKLKvTWmUSo0_gda9FabAQz5x_-GOH1Av50GzFo,3762
37
37
  wizata_dsapi/wizata_dsapi_client.py,sha256=Qz54vYoxRLBUa21Q55K5Oo1qtZpW9ucuXi4BX1N85oE,78716
@@ -42,8 +42,8 @@ wizata_dsapi/plots/__init__.py,sha256=qgnSFqrjOPur-807M8uh5awIfjM1ZHXUXcAqHc-r2l
42
42
  wizata_dsapi/plots/common.py,sha256=jdPsJqLHBwSKc6dX83BSGPqSRxzIVNHSYO5yI_8sjGk,6568
43
43
  wizata_dsapi/scripts/__init__.py,sha256=hAxiETSQf0qOHde1si1tEAJU48seqEgHrchCzS2-LvQ,80
44
44
  wizata_dsapi/scripts/common.py,sha256=efwq-Rd0lvYljIs3gSFz9izogBD7asOU2cTK-IvHTkM,4244
45
- wizata_dsapi-1.2.6.dist-info/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
46
- wizata_dsapi-1.2.6.dist-info/METADATA,sha256=gghYKA1y29GCop-vWf9zC68niDmPfjkmfRZRWyQSg_E,2187
47
- wizata_dsapi-1.2.6.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
48
- wizata_dsapi-1.2.6.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
49
- wizata_dsapi-1.2.6.dist-info/RECORD,,
45
+ wizata_dsapi-1.2.7.dist-info/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
46
+ wizata_dsapi-1.2.7.dist-info/METADATA,sha256=mLlTT4h_hWFEe07idxFfTx1-guTPcgIu56sAfrIoUEA,2187
47
+ wizata_dsapi-1.2.7.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
48
+ wizata_dsapi-1.2.7.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
49
+ wizata_dsapi-1.2.7.dist-info/RECORD,,