wizata-dsapi 1.2.24__tar.gz → 1.2.26__tar.gz

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.
Files changed (54) hide show
  1. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/PKG-INFO +1 -1
  2. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/request.py +47 -12
  3. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/template.py +14 -4
  4. wizata_dsapi-1.2.26/wizata_dsapi/version.py +1 -0
  5. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/wizata_dsapi_client.py +5 -5
  6. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi.egg-info/PKG-INFO +1 -1
  7. wizata_dsapi-1.2.24/wizata_dsapi/version.py +0 -1
  8. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/LICENSE.txt +0 -0
  9. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/README.rst +0 -0
  10. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/setup.cfg +0 -0
  11. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/setup.py +0 -0
  12. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/__init__.py +0 -0
  13. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/api_config.py +0 -0
  14. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/api_dto.py +0 -0
  15. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/api_interface.py +0 -0
  16. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/bucket.py +0 -0
  17. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/business_label.py +0 -0
  18. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/context.py +0 -0
  19. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/dataframe_toolkit.py +0 -0
  20. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/datapoint.py +0 -0
  21. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/datastore.py +0 -0
  22. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/ds_dataframe.py +0 -0
  23. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/dsapi_json_encoder.py +0 -0
  24. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/evaluation.py +0 -0
  25. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/execution.py +0 -0
  26. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/experiment.py +0 -0
  27. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/group_system.py +0 -0
  28. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/ilogger.py +0 -0
  29. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/insight.py +0 -0
  30. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/mlmodel.py +0 -0
  31. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/model_toolkit.py +0 -0
  32. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/models/__init__.py +0 -0
  33. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/models/common.py +0 -0
  34. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/paged_query_result.py +0 -0
  35. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/pipeline.py +0 -0
  36. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/pipeline_image.py +0 -0
  37. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/plot.py +0 -0
  38. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/plots/__init__.py +0 -0
  39. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/plots/common.py +0 -0
  40. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/script.py +0 -0
  41. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/scripts/__init__.py +0 -0
  42. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/scripts/common.py +0 -0
  43. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/solution_component.py +0 -0
  44. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/streamlit_utils.py +0 -0
  45. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/trigger.py +0 -0
  46. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/twin.py +0 -0
  47. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/twinregistration.py +0 -0
  48. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/wizard_function.py +0 -0
  49. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/wizard_request.py +0 -0
  50. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi/words.py +0 -0
  51. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi.egg-info/SOURCES.txt +0 -0
  52. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
  53. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi.egg-info/requires.txt +0 -0
  54. {wizata_dsapi-1.2.24 → wizata_dsapi-1.2.26}/wizata_dsapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wizata_dsapi
3
- Version: 1.2.24
3
+ Version: 1.2.26
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -355,6 +355,36 @@ class Request(ApiDto):
355
355
  else:
356
356
  return
357
357
 
358
+ def set_twin(self, twin):
359
+ """
360
+ set a twin properly (str hardware Id or uuid.UUID)
361
+ :param twin:
362
+ :return:
363
+ """
364
+ if self.template is None:
365
+ self.template = {}
366
+ if isinstance(twin, uuid.UUID):
367
+ self.template['twin_id'] = twin
368
+ elif isinstance(twin, str):
369
+ self.template['twin_hardware_id'] = twin
370
+ else:
371
+ raise TypeError('twin must be str or uuid on request')
372
+
373
+ def set_template(self, template):
374
+ """
375
+ set a template properly (str key or uuid.UUID)
376
+ :param template:
377
+ :return:
378
+ """
379
+ if self.template is None:
380
+ self.template = {}
381
+ if isinstance(template, uuid.UUID):
382
+ self.template['template_id'] = template
383
+ elif isinstance(template, str):
384
+ self.template['template_key'] = template
385
+ else:
386
+ raise TypeError('template must be str or uuid on request')
387
+
358
388
  def __format_date(self, dt_to_format):
359
389
  if isinstance(dt_to_format, datetime):
360
390
  millisec = dt_to_format.timestamp() * 1000
@@ -468,22 +498,27 @@ class Request(ApiDto):
468
498
  else:
469
499
  self.template = {}
470
500
 
471
- if template_id is not None:
501
+ template = None
502
+ if template_key is not None:
503
+ template = template_key
504
+ elif template_id is not None:
472
505
  if isinstance(template_id, uuid.UUID):
473
- self.template['template_id'] = template_id
506
+ template = template_id
474
507
  else:
475
- self.template['template_id'] = uuid.UUID(template_id)
476
- elif template_key is not None:
477
- self.template['template_key'] = str(template_key)
478
-
479
- if twin_id is not None:
508
+ template = uuid.UUID(template_id)
509
+ if template is not None:
510
+ self.set_template(template=template)
511
+
512
+ twin = None
513
+ if twin_hardware_id is not None:
514
+ twin = twin_hardware_id
515
+ elif twin_id is not None:
480
516
  if isinstance(twin_id, uuid.UUID):
481
- self.template['twin_id'] = twin_id
517
+ twin = twin_id
482
518
  else:
483
- self.template['twin_id'] = uuid.UUID(twin_id)
484
-
485
- elif twin_hardware_id is not None:
486
- self.template['twin_hardware_id'] = str(twin_hardware_id)
519
+ twin = uuid.UUID(twin_id)
520
+ if twin is not None:
521
+ self.set_twin(twin=twin)
487
522
 
488
523
  def get_params(self):
489
524
  """
@@ -1,5 +1,6 @@
1
1
  import uuid
2
2
  import json
3
+ from typing import Optional
3
4
 
4
5
  from .api_dto import ApiDto, VarType
5
6
 
@@ -243,7 +244,8 @@ class Template(ApiDto):
243
244
  p_type: VarType,
244
245
  required: bool = True,
245
246
  template_property_id: uuid.UUID = None,
246
- description: str = None):
247
+ description: str = None,
248
+ unit_id: uuid.UUID = None):
247
249
  """
248
250
  add a property to the template.
249
251
  :param str name: name of the property.
@@ -251,6 +253,7 @@ class Template(ApiDto):
251
253
  :param bool required: set if property is required (default: true)
252
254
  :param uuid.UUID template_property_id: technical id of the template property.
253
255
  :param str description: additional information as a description.
256
+ :param uuid.UUID unit_id: unique identifier of unit for datapoint property.
254
257
  """
255
258
 
256
259
  if self.properties is None:
@@ -264,7 +267,8 @@ class Template(ApiDto):
264
267
  name=name,
265
268
  p_type=p_type,
266
269
  required=required,
267
- description=description
270
+ description=description,
271
+ unit_id=unit_id
268
272
  )
269
273
  property_value.template_id = self.template_id
270
274
 
@@ -275,7 +279,7 @@ class Template(ApiDto):
275
279
 
276
280
  self.properties.append(property_value)
277
281
 
278
- def get_property(self, property_name) -> TemplateProperty:
282
+ def get_property(self, property_name) -> Optional[TemplateProperty]:
279
283
  """
280
284
  get a property from its name.
281
285
  :param property_name: name of the property.
@@ -284,6 +288,7 @@ class Template(ApiDto):
284
288
  for t_property in self.properties:
285
289
  if t_property.name == property_name:
286
290
  return t_property
291
+ return None
287
292
 
288
293
  def add_property(self, property_value):
289
294
  """
@@ -317,11 +322,16 @@ class Template(ApiDto):
317
322
  if "description" in property_value:
318
323
  description = property_value["description"]
319
324
 
325
+ unit_id = None
326
+ if "unitId" in property_value and property_value["unitId"] is not None:
327
+ unit_id = uuid.UUID(property_value["unitId"])
328
+
320
329
  self.add(template_property_id=template_property_id,
321
330
  name=name,
322
331
  p_type=p_type,
323
332
  required=required,
324
- description=description)
333
+ description=description,
334
+ unit_id=unit_id)
325
335
  elif isinstance(property_value, TemplateProperty):
326
336
  property_value.template_id = self.template_id
327
337
 
@@ -0,0 +1 @@
1
+ __version__ = "1.2.26"
@@ -662,11 +662,11 @@ class WizataDSAPIClient(ApiInterface):
662
662
 
663
663
  request.set_aggregation(agg_method, interval)
664
664
 
665
- if template is not None or twin is not None:
666
- request.select_template(
667
- template_key=template,
668
- twin_hardware_id=twin
669
- )
665
+ if twin is not None:
666
+ request.set_twin(twin)
667
+
668
+ if template is not None:
669
+ request.set_template(template)
670
670
 
671
671
  if filters is not None:
672
672
  request.filters = filters
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wizata-dsapi
3
- Version: 1.2.24
3
+ Version: 1.2.26
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -1 +0,0 @@
1
- __version__ = "1.2.24"
File without changes
File without changes
File without changes
File without changes