layrz-sdk 2.1.4__py3-none-any.whl → 2.1.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.

Potentially problematic release.


This version of layrz-sdk might be problematic. Click here for more details.

layrz/sdk/lcl/core.py CHANGED
@@ -1,5 +1,7 @@
1
1
  """ Layrz Compute Language SDK """
2
2
 
3
+ from typing import Any
4
+
3
5
  PATTERN_INVALID = 'Pattern should be string, received {received}'
4
6
  INVALID_NUMBER_OF_PARAMS = 'Invalid number of arguments - Expected {expected} - Given {received}'
5
7
  DIFFERENT_TYPES_RANGES = 'Invalid data range, value: {arg1} - Minimum: {arg2} - Maximum: {arg3}'
@@ -10,7 +12,7 @@ INVALID_ARGUMENTS = 'Invalid arguments - {e}'
10
12
  class LclCore:
11
13
  """ Layrz Compute Language SDK """
12
14
 
13
- def __init__(
15
+ def __init__( # pylint: disable=dangerous-default-value
14
16
  self,
15
17
  script: str = '',
16
18
  sensors: dict = {},
@@ -18,7 +20,7 @@ class LclCore:
18
20
  payload: dict = {},
19
21
  asset_constants: dict = {},
20
22
  custom_fields: dict = {},
21
- ):
23
+ ) -> None:
22
24
  """
23
25
  Creates a new instance of LclCore
24
26
  ---
@@ -37,11 +39,11 @@ class LclCore:
37
39
  self._custom_fields = custom_fields
38
40
  self._script = script
39
41
 
40
- def perform(
42
+ def perform( # pylint: disable=dangerous-default-value, invalid-name
41
43
  self,
42
44
  additional_globals: dict = {},
43
45
  additional_locals: dict = {},
44
- ):
46
+ ) -> str:
45
47
  """
46
48
  Perform script using Layrz Compute Language
47
49
  ---
@@ -114,14 +116,14 @@ class LclCore:
114
116
  global_functions.update(additional_globals)
115
117
 
116
118
  import json
117
- result = json.dumps(eval(self._script, global_functions, local_variables))
119
+ result = json.dumps(eval(self._script, global_functions, local_variables)) # pylint: disable=eval-used
118
120
 
119
121
  return result
120
- except Exception as err:
122
+ except Exception as err: # pylint: disable=broad-except
121
123
  import json
122
124
  return json.dumps(INVALID_ARGUMENTS.format(e=err))
123
125
 
124
- def GET_PARAM(self, *args):
126
+ def GET_PARAM(self, *args: list[Any]) -> Any:
125
127
  """ GET_PARAM Function """
126
128
  if len(args) > 2:
127
129
  return INVALID_NUMBER_OF_PARAMS.format(expected=2, received=len(args))
@@ -130,13 +132,13 @@ class LclCore:
130
132
  return self._payload.get(args[0], args[1])
131
133
  return self._payload.get(args[0], None)
132
134
 
133
- def GET_DISTANCE_TRAVELED(self, *args):
135
+ def GET_DISTANCE_TRAVELED(self, *args: list[Any]) -> str | float:
134
136
  """ GET_DISTANCE_TRAVELED Function """
135
137
  if len(args) > 0:
136
138
  return INVALID_NUMBER_OF_PARAMS.format(expected=0, received=len(args))
137
139
  return self._asset_constants.get('distanceTraveled', 0)
138
140
 
139
- def GET_PREVIOUS_SENSOR(self, *args):
141
+ def GET_PREVIOUS_SENSOR(self, *args: list[Any]) -> Any:
140
142
  """ GET_PREVIOUS_SENSOR Function """
141
143
  if len(args) < 1:
142
144
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -148,7 +150,7 @@ class LclCore:
148
150
  return self._previous_sensors.get(args[0], args[1])
149
151
  return self._previous_sensors.get(args[0], None)
150
152
 
151
- def GET_SENSOR(self, *args):
153
+ def GET_SENSOR(self, *args: list[Any]) -> Any:
152
154
  """ GET_SENSOR Function """
153
155
  if len(args) < 1:
154
156
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -160,19 +162,19 @@ class LclCore:
160
162
  return self._sensors.get(args[0], args[1])
161
163
  return self._sensors.get(args[0], None)
162
164
 
163
- def CONSTANT(self, *args):
165
+ def CONSTANT(self, *args: list[Any]) -> Any:
164
166
  """ CONSTANT Function """
165
167
  if len(args) > 1:
166
168
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
167
169
  return args[0]
168
170
 
169
- def GET_CUSTOM_FIELD(self, *args):
171
+ def GET_CUSTOM_FIELD(self, *args: list[Any]) -> str:
170
172
  """ GET_CUSTOM_FIELD Function """
171
173
  if len(args) > 1:
172
174
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
173
175
  return self._custom_fields.get(args[0], '')
174
176
 
175
- def COMPARE(self, *args):
177
+ def COMPARE(self, *args: list[Any]) -> str | None | bool:
176
178
  """ COMPARE Function """
177
179
  if len(args) != 2:
178
180
  return INVALID_NUMBER_OF_PARAMS.format(expected=2, received=len(args))
@@ -180,11 +182,11 @@ class LclCore:
180
182
  if args[0] is None or args[1] is None:
181
183
  return None
182
184
 
183
- if type(args[0]) != type(args[1]):
185
+ if not isinstance(args[0], type(args[1])):
184
186
  return DIFFERENT_TYPES.format(arg1=type(args[0]), arg2=type(args[1]))
185
187
  return args[0] == args[1]
186
188
 
187
- def OR_OPERATOR(self, *args):
189
+ def OR_OPERATOR(self, *args: list[Any]) -> bool:
188
190
  """ OR_OPERATOR Function """
189
191
  result = False
190
192
 
@@ -196,7 +198,7 @@ class LclCore:
196
198
 
197
199
  return result
198
200
 
199
- def AND_OPERATOR(self, *args):
201
+ def AND_OPERATOR(self, *args: list[Any]) -> bool:
200
202
  """ AND_OPERATOR Function """
201
203
  result = False
202
204
  is_first = True
@@ -212,7 +214,7 @@ class LclCore:
212
214
 
213
215
  return result
214
216
 
215
- def SUM(self, *args):
217
+ def SUM(self, *args: list[Any]) -> float:
216
218
  """ SUM Function """
217
219
  result = 0
218
220
 
@@ -221,12 +223,12 @@ class LclCore:
221
223
  continue
222
224
  try:
223
225
  result += float(num)
224
- except:
226
+ except Exception: # pylint: disable=broad-except
225
227
  pass
226
228
 
227
229
  return result
228
230
 
229
- def SUBSTRACT(self, *args):
231
+ def SUBSTRACT(self, *args: list[Any]) -> float:
230
232
  """ SUBSTRACT Function """
231
233
  result = 0
232
234
  is_first = True
@@ -240,12 +242,12 @@ class LclCore:
240
242
  is_first = False
241
243
  else:
242
244
  result -= float(num)
243
- except:
245
+ except Exception: # pylint: disable=broad-except
244
246
  pass
245
247
 
246
248
  return result
247
249
 
248
- def MULTIPLY(self, *args):
250
+ def MULTIPLY(self, *args: list[Any]) -> float:
249
251
  """ MULTIPLY Function """
250
252
  result = 0
251
253
  is_first = True
@@ -259,12 +261,12 @@ class LclCore:
259
261
  result = float(num)
260
262
  else:
261
263
  result *= float(num)
262
- except:
264
+ except Exception: # pylint: disable=broad-except
263
265
  pass
264
266
 
265
267
  return result
266
268
 
267
- def DIVIDE(self, *args):
269
+ def DIVIDE(self, *args: list[Any]) -> float:
268
270
  """ DIVIDE Function """
269
271
  result = 0
270
272
  is_first = True
@@ -278,12 +280,12 @@ class LclCore:
278
280
  result = float(num)
279
281
  else:
280
282
  result /= float(num)
281
- except:
283
+ except Exception: # pylint: disable=broad-except
282
284
  pass
283
285
 
284
286
  return result
285
287
 
286
- def TO_BOOL(self, *args):
288
+ def TO_BOOL(self, *args: list[Any]) -> str | None | bool:
287
289
  """ TO_BOOL Function """
288
290
  if len(args) > 1:
289
291
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -291,7 +293,7 @@ class LclCore:
291
293
  return None
292
294
  return bool(args[0])
293
295
 
294
- def TO_STR(self, *args):
296
+ def TO_STR(self, *args: list[Any]) -> str | None:
295
297
  """ TO_STR Function """
296
298
  if len(args) > 1:
297
299
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -300,7 +302,7 @@ class LclCore:
300
302
  return None
301
303
  return str(args[0])
302
304
 
303
- def TO_INT(self, *args):
305
+ def TO_INT(self, *args: list[Any]) -> str | None | int:
304
306
  """ TO_INT Function """
305
307
  if len(args) > 1:
306
308
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -308,7 +310,7 @@ class LclCore:
308
310
  return None
309
311
  return int(args[0])
310
312
 
311
- def CEIL(self, *args):
313
+ def CEIL(self, *args: list[Any]) -> str | None | int:
312
314
  """ CEIL Function """
313
315
  if len(args) > 1:
314
316
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -317,7 +319,7 @@ class LclCore:
317
319
  import math
318
320
  return math.ceil(args[0])
319
321
 
320
- def FLOOR(self, *args):
322
+ def FLOOR(self, *args: list[Any]) -> str | None | int:
321
323
  """ FLOOR Function """
322
324
  if len(args) > 1:
323
325
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -326,7 +328,7 @@ class LclCore:
326
328
  import math
327
329
  return math.floor(args[0])
328
330
 
329
- def ROUND(self, *args):
331
+ def ROUND(self, *args: list[Any]) -> str | None | int:
330
332
  """ ROUND Function """
331
333
  if len(args) > 1:
332
334
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -334,7 +336,7 @@ class LclCore:
334
336
  return None
335
337
  return round(args[0])
336
338
 
337
- def SQRT(self, *args):
339
+ def SQRT(self, *args: list[Any]) -> str | None | float:
338
340
  """ SQRT Function """
339
341
  if len(args) > 1:
340
342
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -343,14 +345,14 @@ class LclCore:
343
345
  import math
344
346
  return math.sqrt(args[0])
345
347
 
346
- def CONCAT(self, *args):
348
+ def CONCAT(self, *args: list[Any]) -> str | None:
347
349
  """ CONCAT Function """
348
350
  for val in args:
349
351
  if val is None:
350
352
  return None
351
- return ''.join(map(lambda x: str(x), args))
353
+ return ''.join([str(val) for val in args])
352
354
 
353
- def RANDOM(self, *args):
355
+ def RANDOM(self, *args: list[Any]) -> float | str:
354
356
  """ RANDOM Function """
355
357
  if len(args) > 2:
356
358
  return INVALID_NUMBER_OF_PARAMS.format(expected=2, received=len(args))
@@ -360,7 +362,7 @@ class LclCore:
360
362
  import random
361
363
  return random.random() * (float(args[1]) - float(args[0])) + float(args[0])
362
364
 
363
- def RANDOM_INT(self, *args):
365
+ def RANDOM_INT(self, *args: list[Any]) -> int | str:
364
366
  """ RANDOM_INT Function """
365
367
  if len(args) != 2:
366
368
  return INVALID_NUMBER_OF_PARAMS.format(expected=2, received=len(args))
@@ -368,7 +370,7 @@ class LclCore:
368
370
  import random
369
371
  return random.randint(int(args[0]), int(args[1]))
370
372
 
371
- def GREATER_THAN_OR_EQUALS_TO(self, *args):
373
+ def GREATER_THAN_OR_EQUALS_TO(self, *args: list[Any]) -> str | None | bool:
372
374
  """ GREATER_THAN_OR_EQUALS_TO Function """
373
375
  if len(args) > 2:
374
376
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -378,11 +380,11 @@ class LclCore:
378
380
  if args[0] is None or args[1] is None:
379
381
  return None
380
382
 
381
- if type(args[0]) != type(args[1]):
383
+ if not isinstance(args[0], type(args[1])):
382
384
  return DIFFERENT_TYPES.format(arg1=type(args[0]), arg2=type(args[1]))
383
385
  return args[0] >= args[1]
384
386
 
385
- def GREATER_THAN(self, *args):
387
+ def GREATER_THAN(self, *args: list[Any]) -> str | None | bool:
386
388
  """ GREATER_THAN Function """
387
389
  if len(args) > 2:
388
390
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -392,11 +394,11 @@ class LclCore:
392
394
  if args[0] is None or args[1] is None:
393
395
  return None
394
396
 
395
- if type(args[0]) != type(args[1]):
397
+ if not isinstance(args[0], type(args[1])):
396
398
  return DIFFERENT_TYPES.format(arg1=type(args[0]), arg2=type(args[1]))
397
399
  return args[0] > args[1]
398
400
 
399
- def LESS_THAN_OR_EQUALS_TO(self, *args):
401
+ def LESS_THAN_OR_EQUALS_TO(self, *args: list[Any]) -> str | None | bool:
400
402
  """ LESS_THAN_OR_EQUALS_TO Function """
401
403
  if len(args) > 2:
402
404
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -406,11 +408,11 @@ class LclCore:
406
408
  if args[0] is None or args[1] is None:
407
409
  return None
408
410
 
409
- if type(args[0]) != type(args[1]):
411
+ if not isinstance(args[0], type(args[1])):
410
412
  return DIFFERENT_TYPES.format(arg1=type(args[0]), arg2=type(args[1]))
411
413
  return args[0] <= args[1]
412
414
 
413
- def LESS_THAN(self, *args):
415
+ def LESS_THAN(self, *args: list[Any]) -> str | None | bool:
414
416
  """ LESS_THAN Function """
415
417
  if len(args) > 2:
416
418
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -420,11 +422,11 @@ class LclCore:
420
422
  if args[0] is None or args[1] is None:
421
423
  return None
422
424
 
423
- if type(args[0]) != type(args[1]):
425
+ if not isinstance(args[0], type(args[1])):
424
426
  return DIFFERENT_TYPES.format(arg1=type(args[0]), arg2=type(args[1]))
425
427
  return args[0] < args[1]
426
428
 
427
- def DIFFERENT(self, *args):
429
+ def DIFFERENT(self, *args: list[Any]) -> str | None | bool:
428
430
  """ DIFFERENT Function """
429
431
  if len(args) > 2:
430
432
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -434,11 +436,11 @@ class LclCore:
434
436
  if args[0] is None or args[1] is None:
435
437
  return None
436
438
 
437
- if type(args[0]) != type(args[1]):
439
+ if not isinstance(args[0], type(args[1])):
438
440
  return DIFFERENT_TYPES.format(arg1=type(args[0]), arg2=type(args[1]))
439
441
  return args[0] != args[1]
440
442
 
441
- def HEX_TO_STR(self, *args):
443
+ def HEX_TO_STR(self, *args: list[Any]) -> str | None:
442
444
  """ HEX_TO_STR Function """
443
445
  if len(args) > 1:
444
446
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -448,7 +450,7 @@ class LclCore:
448
450
  byte_array = bytes.fromhex(args[0])
449
451
  return byte_array.decode('ASCII')
450
452
 
451
- def STR_TO_HEX(self, *args):
453
+ def STR_TO_HEX(self, *args: list[Any]) -> str | None:
452
454
  """ STR_TO_HEX Function """
453
455
  if len(args) > 1:
454
456
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -456,7 +458,7 @@ class LclCore:
456
458
  return None
457
459
  return str(args[0]).encode('ASCII').hex()
458
460
 
459
- def HEX_TO_INT(self, *args):
461
+ def HEX_TO_INT(self, *args: list[Any]) -> str | None | int:
460
462
  """ HEX_TO_INT Function """
461
463
  if len(args) > 1:
462
464
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -464,7 +466,7 @@ class LclCore:
464
466
  return None
465
467
  return int(int(args[0], 16))
466
468
 
467
- def INT_TO_HEX(self, *args):
469
+ def INT_TO_HEX(self, *args: list[Any]) -> str | None:
468
470
  """ INT_TO_HEX Function """
469
471
  if len(args) > 1:
470
472
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -472,7 +474,7 @@ class LclCore:
472
474
  return None
473
475
  return hex(int(args[0]))[2:]
474
476
 
475
- def TO_FLOAT(self, *args):
477
+ def TO_FLOAT(self, *args: list[Any]) -> str | None | float:
476
478
  """ TO_FLOAT Function """
477
479
  if len(args) > 1:
478
480
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
@@ -480,65 +482,64 @@ class LclCore:
480
482
  return None
481
483
  return float(args[0])
482
484
 
483
- def IS_PARAMETER_PRESENT(self, *args):
485
+ def IS_PARAMETER_PRESENT(self, *args: list[Any]) -> str | bool:
484
486
  """ IS_PARAMETER_PRESENT Function """
485
487
  if len(args) > 1:
486
488
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
487
489
 
488
490
  return args[0] in self._payload
489
491
 
490
- def IS_SENSOR_PRESENT(self, *args):
492
+ def IS_SENSOR_PRESENT(self, *args: list[Any]) -> str | bool:
491
493
  """ IS_SENSOR_PRESENT Function """
492
494
  if len(args) > 1:
493
495
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
494
496
 
495
497
  return args[0] in self._sensors
496
498
 
497
- def INSIDE_RANGE(self, *args):
499
+ def INSIDE_RANGE(self, *args: list[Any]) -> str | None | bool:
498
500
  """ INSIDE_RANGE Function """
499
501
  if len(args) != 3:
500
502
  return INVALID_NUMBER_OF_PARAMS.format(expected=3, received=len(args))
501
503
 
502
504
  if args[0] is None or args[1] is None or args[2] is None:
503
505
  return None
504
- if type(args[0]) != type(args[1]) or type(args[0]) != type(args[2]):
506
+ if not isinstance(args[0], type(args[1])):
505
507
  return DIFFERENT_TYPES_RANGES.format(arg1=type(args[0]), arg2=type(args[1]), arg3=type(args[2]))
506
508
 
507
509
  return args[1] <= args[0] <= args[2]
508
510
 
509
- def OUTSIDE_RANGE(self, *args):
511
+ def OUTSIDE_RANGE(self, *args: list[Any]) -> str | None | bool:
510
512
  """ OUTSIDE_RANGE Function """
511
513
  if len(args) != 3:
512
514
  return INVALID_NUMBER_OF_PARAMS.format(expected=3, received=len(args))
513
515
 
514
516
  if args[0] is None or args[1] is None or args[2] is None:
515
517
  return None
516
- if type(args[0]) != type(args[1]) or type(args[0]) != type(args[2]):
518
+ if not isinstance(args[0], type(args[1])):
517
519
  return DIFFERENT_TYPES_RANGES.format(arg1=type(args[0]), arg2=type(args[1]), arg3=type(args[2]))
518
520
 
519
- return not (args[1] <= args[0] <= args[2])
521
+ return not args[1] <= args[0] <= args[2]
520
522
 
521
- def GET_TIME_DIFFERENCE(self, *args):
523
+ def GET_TIME_DIFFERENCE(self, *args: list[Any]) -> str | float:
522
524
  """ GET_TIME_DIFFERENCE Function """
523
525
  if len(args) > 0:
524
526
  return INVALID_NUMBER_OF_PARAMS.format(expected=0, received=len(args))
525
527
  return self._asset_constants.get('timeElapsed', 0)
526
528
 
527
- def IF(self, *args):
529
+ def IF(self, *args: list[Any]) -> Any:
528
530
  """ IF Function """
529
531
  if len(args) != 3:
530
532
  return INVALID_NUMBER_OF_PARAMS.format(expected=3, received=len(args))
531
533
 
532
534
  return args[1] if args[0] else args[2]
533
535
 
534
- def NOW(self, *args):
536
+ def NOW(self, *args: list[Any]) -> float: # pylint: disable=unused-argument
535
537
  """ NOW Function """
538
+ import zoneinfo
536
539
  from datetime import datetime
540
+ return datetime.utcnow(tz=zoneinfo.ZoneInfo('UTC')).timestamp()
537
541
 
538
- import pytz
539
- return datetime.now(tz=pytz.utc).timestamp()
540
-
541
- def REGEX(self, *args):
542
+ def REGEX(self, *args: list[Any]) -> str | None | bool:
542
543
  """ REGEX Function """
543
544
  if len(args) != 2:
544
545
  return INVALID_NUMBER_OF_PARAMS.format(expected=2, received=len(args))
@@ -546,56 +547,56 @@ class LclCore:
546
547
  if args[0] is None or args[1] is None:
547
548
  return None
548
549
 
549
- if type(args[0]) != str:
550
+ if not isinstance(args[0], str):
550
551
  return PATTERN_INVALID.format(received=type(args[0]))
551
552
 
552
553
  import re
553
554
  pattern = re.compile(args[1])
554
555
  return bool(pattern.match(args[0]))
555
556
 
556
- def IS_NONE(self, *args):
557
+ def IS_NONE(self, *args: list[Any]) -> str | bool:
557
558
  """ IS_NONE Function """
558
559
  if len(args) != 1:
559
560
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
560
561
 
561
562
  return args[0] is None
562
563
 
563
- def NOT(self, *args):
564
+ def NOT(self, *args: list[Any]) -> str | bool:
564
565
  """ NOT Function """
565
566
  if len(args) != 1:
566
567
  return INVALID_NUMBER_OF_PARAMS.format(expected=1, received=len(args))
567
568
 
568
569
  return not args[0]
569
570
 
570
- def CONTAINS(self, *args):
571
+ def CONTAINS(self, *args: list[Any]) -> str | bool:
571
572
  """ CONTAINS function """
572
573
  if len(args) != 2:
573
574
  return INVALID_NUMBER_OF_PARAMS.format(expected=2, received=len(args))
574
575
 
575
576
  return str(args[0]) in str(args[1])
576
577
 
577
- def STARTS_WITH(self, *args):
578
+ def STARTS_WITH(self, *args: list[Any]) -> str | bool:
578
579
  """ STARTS_WITH function """
579
580
  if len(args) != 2:
580
581
  return INVALID_NUMBER_OF_PARAMS.format(expected=2, received=len(args))
581
582
 
582
583
  return str(args[1]).startswith(str(args[0]))
583
584
 
584
- def ENDS_WITH(self, *args):
585
+ def ENDS_WITH(self, *args: list[Any]) -> str | bool:
585
586
  """ ENDS_WITH function """
586
587
  if len(args) != 2:
587
588
  return INVALID_NUMBER_OF_PARAMS.format(expected=2, received=len(args))
588
589
 
589
590
  return str(args[1]).endswith(str(args[0]))
590
591
 
591
- def PRIMARY_DEVICE(self, *args):
592
+ def PRIMARY_DEVICE(self, *args: list[Any]) -> str:
592
593
  """ PRIMARY_DEVICE function """
593
594
  if len(args) > 0:
594
595
  return INVALID_NUMBER_OF_PARAMS.format(expected=0, received=len(args))
595
596
 
596
597
  return self._asset_constants.get('primaryDevice', None)
597
598
 
598
- def SUBSTRING(self, *args):
599
+ def SUBSTRING(self, *args: list[Any]) -> str:
599
600
  """ Get a substring from string (args[0]) """
600
601
  if len(args) < 2:
601
602
  return INVALID_NUMBER_OF_PARAMS.format(
@@ -621,9 +622,22 @@ class LclCore:
621
622
  return args[0][args[1]:args[2]]
622
623
  return args[0][args[1]:]
623
624
 
624
- def UNIX_TO_STR(self, *args):
625
+ def UNIX_TO_STR(self, *args: list[Any]) -> str:
625
626
  """ Convert UNIX timestamp date (args[0]) to format (args[1]) string """
626
- if len(args) != 2:
627
+ if len(args) < 2:
627
628
  return INVALID_NUMBER_OF_PARAMS.format(expected=2, received=len(args))
629
+ import zoneinfo
628
630
  from datetime import datetime
629
- return datetime.fromtimestamp(int(args[0])).strftime(args[1])
631
+
632
+ tz = zoneinfo.ZoneInfo('UTC')
633
+
634
+ if len(args) > 2:
635
+ try:
636
+ tz = zoneinfo.ZoneInfo(args[2])
637
+ except zoneinfo.ZoneInfoNotFoundError:
638
+ tz = zoneinfo.ZoneInfo('UTC')
639
+
640
+ return datetime.fromtimestamp(int(args[0]))\
641
+ .replace(tzinfo=zoneinfo.ZoneInfo('UTC'))\
642
+ .astimezone(tz)\
643
+ .strftime(args[1])
@@ -1,10 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: layrz-sdk
3
- Version: 2.1.4
3
+ Version: 2.1.7
4
4
  Summary: Layrz SDK for Python
5
5
  Author-email: "Golden M, Inc." <software@goldenm.com>
6
- Maintainer-email: Kenny Mochizuki <kenny@goldenm.com>
6
+ Maintainer-email: Kenny Mochizuki <kenny@goldenm.com>, Luis Reyes <lreyes@goldenm.com>, Kasen Li <kli@goldenm.com>
7
7
  License: MIT License
8
+ Project-URL: Repository, https://github.com/goldenm-software/layrz-sdk
9
+ Project-URL: Changelog, https://github.com/goldenm-software/layrz-sdk/blob/main/CHANGELOG.md
8
10
  Keywords: sdk,goldenm,lcl,layrz compute language,layrz
9
11
  Classifier: Programming Language :: Python :: 3
10
12
  Classifier: Programming Language :: Python :: 3.10
@@ -32,7 +34,7 @@ It's available in our documentation site [developers.layrz.com](https://develope
32
34
  Golden M is a software/hardware development company what is working on
33
35
  a new, innovative and disruptive technologies.
34
36
 
35
- For more information, contact us at [sales@goldenmcorp.com](mailto:sales@goldenmcorp.com)
37
+ For more information, contact us at [sales@goldenm.com](mailto:sales@goldenm.com)
36
38
 
37
39
  ## License
38
40
  This project is under MIT License, for more information, check out the `LICENCE`
@@ -1,4 +1,3 @@
1
- layrz/__init__.py,sha256=IOjOJr8rj6xf1EyQmWjoP1zsNWhGZ-3prQVdyvO9d9E,213
2
1
  layrz/sdk/__init__.py,sha256=Am2QkkucYd98jo7Sg-uWMzaWIxX7ZZBWT4fl_tC_a3A,17
3
2
  layrz/sdk/test.py,sha256=ukcbEysgvi07wsrq_T9JHuIvJBTHce9CuTag3gXz6sE,18
4
3
  layrz/sdk/entities/__init__.py,sha256=YsYX1AtWx7VprfFHIw1yrdo2hig6_h0WBeNpT_4Bnfw,461
@@ -61,9 +60,9 @@ layrz/sdk/entities/telemetry/position.py,sha256=z_YinELeG0lBl_dIzEK9mvq7r-L7Jxv3
61
60
  layrz/sdk/helpers/__init__.py,sha256=h_C2SaMtW6seM5EQYjpyL1BLZOg5-ixqFzrejtS5IVQ,38
62
61
  layrz/sdk/helpers/color.py,sha256=w0JM9QiPcbcG91C0hcRMelh8WBmkns2Fr5bT5AFNUYw,1049
63
62
  layrz/sdk/lcl/__init__.py,sha256=nmfOnbot49pvfR8xyqvs0tg7ZwzxunhWJbwA805w20M,67
64
- layrz/sdk/lcl/core.py,sha256=aJcotMYj00kFTI2jtYIMCECkr26Yz_qZ65Z2NvjM_LY,18650
65
- layrz_sdk-2.1.4.dist-info/LICENSE,sha256=vkKQGO9Zx8ROtjnsM_NU0Q9OWIVmsPdrR55pAzpf-Pc,1052
66
- layrz_sdk-2.1.4.dist-info/METADATA,sha256=5u9ZyPFOIU4eTqne0Osf4JPrdYSmtbMkeQFiRx6Ao5Q,1261
67
- layrz_sdk-2.1.4.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
68
- layrz_sdk-2.1.4.dist-info/top_level.txt,sha256=3T3zjRGOIP0hjf8rP2FlFk9qIO5l-UZirK4cAkD-VFg,6
69
- layrz_sdk-2.1.4.dist-info/RECORD,,
63
+ layrz/sdk/lcl/core.py,sha256=VMX5cpaQPhrQ2lmH9LpL2tK0zU2ZyZruDNwfkuUKipw,20641
64
+ layrz_sdk-2.1.7.dist-info/LICENSE,sha256=vkKQGO9Zx8ROtjnsM_NU0Q9OWIVmsPdrR55pAzpf-Pc,1052
65
+ layrz_sdk-2.1.7.dist-info/METADATA,sha256=qZUqL_6LKksth6hIzdvNY-xetrpheVZhd62YM_HbBOY,1478
66
+ layrz_sdk-2.1.7.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
67
+ layrz_sdk-2.1.7.dist-info/top_level.txt,sha256=3T3zjRGOIP0hjf8rP2FlFk9qIO5l-UZirK4cAkD-VFg,6
68
+ layrz_sdk-2.1.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.41.3)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
layrz/__init__.py DELETED
@@ -1,10 +0,0 @@
1
- """ Layrz namespace package """
2
-
3
- try:
4
- import pkg_resources
5
-
6
- pkg_resources.declare_namespace(__name__)
7
- except ImportError:
8
- import pkgutil
9
-
10
- __path__ = pkgutil.extend_path(__path__, __name__) # type: ignore