wizata-dsapi 1.2.25__py3-none-any.whl → 1.2.27__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/dataframe_toolkit.py +4 -4
- wizata_dsapi/request.py +47 -12
- wizata_dsapi/version.py +1 -1
- wizata_dsapi/wizata_dsapi_client.py +5 -5
- {wizata_dsapi-1.2.25.dist-info → wizata_dsapi-1.2.27.dist-info}/METADATA +1 -1
- {wizata_dsapi-1.2.25.dist-info → wizata_dsapi-1.2.27.dist-info}/RECORD +9 -9
- {wizata_dsapi-1.2.25.dist-info → wizata_dsapi-1.2.27.dist-info}/LICENSE.txt +0 -0
- {wizata_dsapi-1.2.25.dist-info → wizata_dsapi-1.2.27.dist-info}/WHEEL +0 -0
- {wizata_dsapi-1.2.25.dist-info → wizata_dsapi-1.2.27.dist-info}/top_level.txt +0 -0
|
@@ -148,7 +148,7 @@ def df_from_dict(df_dict: dict) -> pandas.DataFrame:
|
|
|
148
148
|
raise ValueError('if using a multi-line dataframe please provide a Timestamp column')
|
|
149
149
|
|
|
150
150
|
if "Timestamp" not in df_dict:
|
|
151
|
-
df_dict["Timestamp"] = [datetime.
|
|
151
|
+
df_dict["Timestamp"] = [datetime.now(timezone.utc)]
|
|
152
152
|
else:
|
|
153
153
|
timestamp_col = []
|
|
154
154
|
for timestamp_ms in df_dict["Timestamp"]:
|
|
@@ -208,7 +208,7 @@ def verify_relative_datetime(formatted_string: str) -> bool:
|
|
|
208
208
|
def generate_epoch(formatted_string: str, now=None):
|
|
209
209
|
"""
|
|
210
210
|
generate an epoch based on a formatted string (e.g. now+6h) - see documentation.
|
|
211
|
-
* now = datetime.
|
|
211
|
+
* now = datetime.now(timezone.utc) can be override
|
|
212
212
|
* units = 'y' = 365d, 'M'=30d , 'w'=7d , 'd'=24h , 'h'=60m, 'm'=60s , 's'=1000'ms'
|
|
213
213
|
* operators = '+' or '-'
|
|
214
214
|
:param formatted_string: formatted epoch representation using relative time.
|
|
@@ -216,7 +216,7 @@ def generate_epoch(formatted_string: str, now=None):
|
|
|
216
216
|
:return: epoch in ms.
|
|
217
217
|
"""
|
|
218
218
|
if now is None:
|
|
219
|
-
now = datetime.
|
|
219
|
+
now = datetime.now(timezone.utc)
|
|
220
220
|
|
|
221
221
|
pattern = r'^now([+-]\d+([yMwdHhms]{1,2}))?$'
|
|
222
222
|
match = re.match(pattern, formatted_string)
|
|
@@ -274,5 +274,5 @@ def generate_unique_key() -> str:
|
|
|
274
274
|
- 11 char for 'animal_'
|
|
275
275
|
- 3 car for number XXX
|
|
276
276
|
"""
|
|
277
|
-
return f"{datetime.now().strftime('%y%m%d')}_{random.choice(colors).lower()}_" \
|
|
277
|
+
return f"{datetime.now(timezone.utc).strftime('%y%m%d')}_{random.choice(colors).lower()}_" \
|
|
278
278
|
f"{random.choice(animals).lower()}_{random.randint(1, 999)}"
|
wizata_dsapi/request.py
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
506
|
+
template = template_id
|
|
474
507
|
else:
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
self.template
|
|
478
|
-
|
|
479
|
-
|
|
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
|
-
|
|
517
|
+
twin = twin_id
|
|
482
518
|
else:
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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
|
"""
|
wizata_dsapi/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.2.
|
|
1
|
+
__version__ = "1.2.27"
|
|
@@ -662,11 +662,11 @@ class WizataDSAPIClient(ApiInterface):
|
|
|
662
662
|
|
|
663
663
|
request.set_aggregation(agg_method, interval)
|
|
664
664
|
|
|
665
|
-
if
|
|
666
|
-
request.
|
|
667
|
-
|
|
668
|
-
|
|
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
|
|
@@ -5,7 +5,7 @@ wizata_dsapi/api_interface.py,sha256=DURk-0ey16T8sV5e2Y2G_YybPEusJvZuY0oD5L7AnXo
|
|
|
5
5
|
wizata_dsapi/bucket.py,sha256=Zz9olv-pymikAutGitSuGWrAPiawOTW86JDDHG4ugTc,1150
|
|
6
6
|
wizata_dsapi/business_label.py,sha256=u0TVfUNfoR9qSv8lzpf6rNjlg3G9xTiz6itefcKfeak,4151
|
|
7
7
|
wizata_dsapi/context.py,sha256=M7hsvXoU0Bn_5ONDB-5VvjriMpno6bAgh0RrJ9Y-h7U,11600
|
|
8
|
-
wizata_dsapi/dataframe_toolkit.py,sha256=
|
|
8
|
+
wizata_dsapi/dataframe_toolkit.py,sha256=7D8JrhsFSGXeO3mRAd2e2cLmdjbXRjk04IuaMG8F974,9078
|
|
9
9
|
wizata_dsapi/datapoint.py,sha256=UUatqzWMwC4ucM6HdeQDWtLS4fGqEsDABCNVmxoP5Hg,14635
|
|
10
10
|
wizata_dsapi/datastore.py,sha256=BSHZmCSJ679boBA1eCkaWGJCy1CUeipKKGt2jDHzdVo,2663
|
|
11
11
|
wizata_dsapi/ds_dataframe.py,sha256=Sk2JRUuTRJzko3HosJnbK34STpgSJUlqxLq8w_E5VM4,2089
|
|
@@ -23,7 +23,7 @@ wizata_dsapi/pipeline.py,sha256=WDJeOxPZJiYW1qwTNZUm3jom2epIxqrSoiUwcrTF9EE,3130
|
|
|
23
23
|
wizata_dsapi/pipeline_deployment.py,sha256=grekBaxUK0EhL9w7lDB8vNuW_wzLnHVm9Mq8Lkbkguk,1722
|
|
24
24
|
wizata_dsapi/pipeline_image.py,sha256=M3FOr45dJIAEvsmXPpMD8JZ09k5-YpW9PRYEWJqptcI,5272
|
|
25
25
|
wizata_dsapi/plot.py,sha256=SPGKFWWYNcRvHcqvvnPIIIBKsd5UwhdsxLW7b2dG2rs,2360
|
|
26
|
-
wizata_dsapi/request.py,sha256=
|
|
26
|
+
wizata_dsapi/request.py,sha256=W4E1BHacQdJiBLPI96yVeHz41rbfFuGrbuw1U60L_DM,27560
|
|
27
27
|
wizata_dsapi/script.py,sha256=DeEciwVpuCYZetgJCoivw_bYe8ma52WuTaTQ_VkLEcg,12930
|
|
28
28
|
wizata_dsapi/solution_component.py,sha256=8gbZWx2h_xUqI_pAXa3goqAnR5Y-GDMii8MeGlaK1IE,9531
|
|
29
29
|
wizata_dsapi/streamlit_utils.py,sha256=sXBdygktbixV828Zg01Nl27_a4F8zGFc4RY0C8g-1bc,1942
|
|
@@ -31,10 +31,10 @@ wizata_dsapi/template.py,sha256=wtCRKKk3PchH4RrNgNYlEF_9C6bzZwKIeLyEvgv6Fdo,1370
|
|
|
31
31
|
wizata_dsapi/trigger.py,sha256=w3BZYP-L3SUwvaT0oCTanh_Ewn57peZvlt7vxzHv9J8,5129
|
|
32
32
|
wizata_dsapi/twin.py,sha256=S0DUzQf1smZXZTdXpXZPtkZYCfKIhw53EecCnsl9i4Q,11017
|
|
33
33
|
wizata_dsapi/twinregistration.py,sha256=Mi6-YuwroiEXc0c1hgrOaphh4hNVoHupxOnXedVtJtE,13377
|
|
34
|
-
wizata_dsapi/version.py,sha256=
|
|
34
|
+
wizata_dsapi/version.py,sha256=JKArgvnX6ljUI_WxYnXTejXGdjsA4KJ3Cy2xBcK4vh4,23
|
|
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
|
-
wizata_dsapi/wizata_dsapi_client.py,sha256=
|
|
37
|
+
wizata_dsapi/wizata_dsapi_client.py,sha256=kos_8j47CBXiy6y6b_H2yDUe3aWh76diEmWjCisYKkY,78662
|
|
38
38
|
wizata_dsapi/words.py,sha256=tV8CqzCqODZCV7PgBxBF5exBxeF_ya9t5DiUy-cg6Sg,1535
|
|
39
39
|
wizata_dsapi/models/__init__.py,sha256=O5PHqw8lKILw4apO-MfDxPz73wK0vADD9y3xjuzX7Tw,104
|
|
40
40
|
wizata_dsapi/models/common.py,sha256=1dTqE80-mFJnUwEdNlJdhJzfZ2N5Kp8Nb3LQ8uwPtLc,3808
|
|
@@ -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.
|
|
46
|
-
wizata_dsapi-1.2.
|
|
47
|
-
wizata_dsapi-1.2.
|
|
48
|
-
wizata_dsapi-1.2.
|
|
49
|
-
wizata_dsapi-1.2.
|
|
45
|
+
wizata_dsapi-1.2.27.dist-info/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
46
|
+
wizata_dsapi-1.2.27.dist-info/METADATA,sha256=idjFas_BsW1WjABbd60xyTwUAh0JWIkhvafZWvg6PS8,2188
|
|
47
|
+
wizata_dsapi-1.2.27.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
48
|
+
wizata_dsapi-1.2.27.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
|
|
49
|
+
wizata_dsapi-1.2.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|