layrz-sdk 3.0.10__py3-none-any.whl → 3.0.12__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.

@@ -1,4 +1,5 @@
1
- """ Init file """
1
+ """Init file"""
2
+
2
3
  # Broadcast entities
3
4
  from .broadcasts import BroadcastRequest, BroadcastResponse, BroadcastResult, BroadcastStatus, OutboundService
4
5
 
@@ -7,41 +8,41 @@ from .cases import Case, CaseIgnoredStatus, CaseStatus, Comment, Trigger
7
8
 
8
9
  # Charts entities
9
10
  from .charts import (
10
- AreaChart,
11
- AxisConfig,
12
- BarChart,
13
- ChartAlignment,
14
- ChartColor,
15
- ChartConfiguration,
16
- ChartDataSerie,
17
- ChartDataSerieType,
18
- ChartDataType,
19
- ChartException,
20
- ChartRenderTechnology,
21
- ColumnChart,
22
- HTMLChart,
23
- LineChart,
24
- MapCenterType,
25
- MapChart,
26
- MapPoint,
27
- NumberChart,
28
- PieChart,
29
- RadarChart,
30
- RadialBarChart,
31
- ScatterChart,
32
- ScatterSerie,
33
- ScatterSerieItem,
34
- TableChart,
35
- TableHeader,
36
- TableRow,
37
- TimelineChart,
38
- TimelineSerie,
39
- TimelineSerieItem,
40
- get_color_list,
11
+ AreaChart,
12
+ AxisConfig,
13
+ BarChart,
14
+ ChartAlignment,
15
+ ChartColor,
16
+ ChartConfiguration,
17
+ ChartDataSerie,
18
+ ChartDataSerieType,
19
+ ChartDataType,
20
+ ChartException,
21
+ ChartRenderTechnology,
22
+ ColumnChart,
23
+ HTMLChart,
24
+ LineChart,
25
+ MapCenterType,
26
+ MapChart,
27
+ MapPoint,
28
+ NumberChart,
29
+ PieChart,
30
+ RadarChart,
31
+ RadialBarChart,
32
+ ScatterChart,
33
+ ScatterSerie,
34
+ ScatterSerieItem,
35
+ TableChart,
36
+ TableHeader,
37
+ TableRow,
38
+ TimelineChart,
39
+ TimelineSerie,
40
+ TimelineSerieItem,
41
+ get_color_list,
41
42
  )
42
43
 
43
44
  # Checkpoints entities
44
- from .checkpoints import Checkpoint, Geofence, Waypoint
45
+ from .checkpoints import Checkpoint, Waypoint
45
46
 
46
47
  # Events entities
47
48
  from .events import Event
@@ -50,22 +51,22 @@ from .events import Event
50
51
  from .formatting import TextAlignment
51
52
 
52
53
  # General entities
53
- from .general import Asset, AssetOperationMode, CustomField, Device, Sensor, User
54
+ from .general import Asset, AssetOperationMode, CustomField, Device, Geofence, PresenceType, Sensor, User
54
55
 
55
56
  # REPCOM entities
56
57
  from .repcom import Transaction
57
58
 
58
59
  # Reports entities
59
60
  from .reports import (
60
- CustomReportPage,
61
- Report,
62
- ReportCol,
63
- ReportConfiguration,
64
- ReportDataType,
65
- ReportFormat,
66
- ReportHeader,
67
- ReportPage,
68
- ReportRow,
61
+ CustomReportPage,
62
+ Report,
63
+ ReportCol,
64
+ ReportConfiguration,
65
+ ReportDataType,
66
+ ReportFormat,
67
+ ReportHeader,
68
+ ReportPage,
69
+ ReportRow,
69
70
  )
70
71
 
71
72
  # Telemetry entities
@@ -1,4 +1,4 @@
1
- """ Checkpoints entities """
1
+ """Checkpoints entities"""
2
+
2
3
  from .checkpoint import Checkpoint
3
- from .geofence import Geofence
4
4
  from .waypoint import Waypoint
@@ -2,7 +2,7 @@
2
2
 
3
3
  from datetime import datetime
4
4
 
5
- from .geofence import Geofence
5
+ from layrz_sdk.entities.general.geofence import Geofence
6
6
 
7
7
 
8
8
  class Waypoint:
@@ -3,6 +3,7 @@
3
3
  from datetime import datetime
4
4
 
5
5
  from layrz_sdk.entities.cases.trigger import Trigger
6
+ from layrz_sdk.entities.general.geofence import Geofence, PresenceType
6
7
  from layrz_sdk.entities.telemetry.message import Message
7
8
 
8
9
 
@@ -17,6 +18,8 @@ class Event:
17
18
  asset_id : ID of the Asset owner of the event
18
19
  message : Telemetry information of the event
19
20
  activated_at : Reception/triggered at
21
+ geofence : Geofence where the event occurred
22
+ presence_type : Presence type of the event
20
23
  """
21
24
 
22
25
  def __init__(
@@ -26,6 +29,8 @@ class Event:
26
29
  asset_id: int,
27
30
  message: Message,
28
31
  activated_at: datetime,
32
+ geofence: Geofence | None = None,
33
+ presence_type: PresenceType | None = None,
29
34
  ) -> None:
30
35
  """Constructor"""
31
36
  self.pk = pk
@@ -33,6 +38,8 @@ class Event:
33
38
  self.asset_id = asset_id
34
39
  self.message = message
35
40
  self.activated_at = activated_at
41
+ self.geofence = geofence
42
+ self.presence_type = presence_type
36
43
 
37
44
  @property
38
45
  def _readable(self) -> str | None | bool:
@@ -1,7 +1,9 @@
1
- """ General entities """
1
+ """General entities"""
2
+
2
3
  from .asset import Asset
3
4
  from .asset_operation_mode import AssetOperationMode
4
5
  from .custom_field import CustomField
5
6
  from .device import Device
7
+ from .geofence import Geofence, PresenceType
6
8
  from .sensor import Sensor
7
9
  from .user import User
@@ -1,5 +1,7 @@
1
1
  """Geofence entity"""
2
2
 
3
+ from enum import Enum
4
+
3
5
 
4
6
  class Geofence:
5
7
  """
@@ -29,3 +31,23 @@ class Geofence:
29
31
  def __repr__(self) -> str | None | bool:
30
32
  """Readable property"""
31
33
  return self._readable
34
+
35
+
36
+ class PresenceType(Enum):
37
+ """Presence type enum"""
38
+
39
+ ENTRANCE = 'ENTRANCE'
40
+ EXIT = 'EXIT'
41
+
42
+ @property
43
+ def _readable(self) -> str | None | bool:
44
+ """Readable"""
45
+ return f'PresenceType.{self.value}'
46
+
47
+ def __str__(self) -> str | None | bool:
48
+ """Readable property"""
49
+ return self._readable
50
+
51
+ def __repr__(self) -> str | None | bool:
52
+ """Readable property"""
53
+ return self._readable
layrz_sdk/lcl/core.py CHANGED
@@ -13,7 +13,7 @@ INVALID_ARGUMENTS = 'Invalid arguments - {e}'
13
13
  class LclCore:
14
14
  """Layrz Compute Language SDK"""
15
15
 
16
- def __init__( # pylint: disable=dangerous-default-value
16
+ def __init__(
17
17
  self,
18
18
  script: str = '',
19
19
  sensors: Dict = None,
@@ -40,7 +40,7 @@ class LclCore:
40
40
  self._custom_fields = custom_fields
41
41
  self._script = script
42
42
 
43
- def perform( # pylint: disable=dangerous-default-value, invalid-name
43
+ def perform(
44
44
  self,
45
45
  additional_globals: Dict = None,
46
46
  additional_locals: Dict = None,
@@ -122,14 +122,26 @@ class LclCore:
122
122
 
123
123
  import json
124
124
 
125
- result = json.dumps(eval(self._script, global_functions, local_variables)) # pylint: disable=eval-used
125
+ result = json.dumps(eval(self._script, global_functions, local_variables))
126
126
 
127
127
  return result
128
- except Exception as err: # pylint: disable=broad-except
128
+ except Exception as err:
129
129
  import json
130
130
 
131
131
  return json.dumps(INVALID_ARGUMENTS.format(e=err))
132
132
 
133
+ def _standarize_datatypes(self, args: List[Any]) -> List[Any]:
134
+ """Standarize data types"""
135
+ result_args = []
136
+
137
+ for arg in args:
138
+ if isinstance(arg, (float, int)):
139
+ result_args.append(float(arg))
140
+ else:
141
+ result_args.append(arg)
142
+
143
+ return result_args
144
+
133
145
  def GET_PARAM(self, *args: List[Any]) -> Any:
134
146
  """GET_PARAM Function"""
135
147
  if len(args) > 2:
@@ -198,6 +210,8 @@ class LclCore:
198
210
  if args[0] is None or args[1] is None:
199
211
  return None
200
212
 
213
+ args = self._standarize_datatypes(args)
214
+
201
215
  if not isinstance(args[0], type(args[1])):
202
216
  return DIFFERENT_TYPES.format(arg1=type(args[0]).__name__, arg2=type(args[1]).__name__)
203
217
  return args[0] == args[1]
@@ -241,7 +255,7 @@ class LclCore:
241
255
 
242
256
  try:
243
257
  result += float(num)
244
- except Exception: # pylint: disable=broad-except
258
+ except Exception:
245
259
  pass
246
260
 
247
261
  return result
@@ -261,7 +275,7 @@ class LclCore:
261
275
  is_first = False
262
276
  else:
263
277
  result -= float(num)
264
- except Exception: # pylint: disable=broad-except
278
+ except Exception:
265
279
  pass
266
280
 
267
281
  return result
@@ -281,7 +295,7 @@ class LclCore:
281
295
  result = float(num)
282
296
  else:
283
297
  result *= float(num)
284
- except Exception: # pylint: disable=broad-except
298
+ except Exception:
285
299
  pass
286
300
 
287
301
  return result
@@ -301,7 +315,7 @@ class LclCore:
301
315
  result = float(num)
302
316
  else:
303
317
  result /= float(num)
304
- except Exception: # pylint: disable=broad-except
318
+ except Exception:
305
319
  pass
306
320
 
307
321
  return result
@@ -435,6 +449,8 @@ class LclCore:
435
449
  if args[0] is None or args[1] is None:
436
450
  return None
437
451
 
452
+ args = self._standarize_datatypes(args)
453
+
438
454
  if not isinstance(args[0], type(args[1])):
439
455
  return DIFFERENT_TYPES.format(arg1=type(args[0]).__name__, arg2=type(args[1]).__name__)
440
456
  return args[0] >= args[1]
@@ -449,6 +465,8 @@ class LclCore:
449
465
  if args[0] is None or args[1] is None:
450
466
  return None
451
467
 
468
+ args = self._standarize_datatypes(args)
469
+
452
470
  if not isinstance(args[0], type(args[1])):
453
471
  return DIFFERENT_TYPES.format(arg1=type(args[0]).__name__, arg2=type(args[1]).__name__)
454
472
  return args[0] > args[1]
@@ -463,6 +481,8 @@ class LclCore:
463
481
  if args[0] is None or args[1] is None:
464
482
  return None
465
483
 
484
+ args = self._standarize_datatypes(args)
485
+
466
486
  if not isinstance(args[0], type(args[1])):
467
487
  return DIFFERENT_TYPES.format(arg1=type(args[0]).__name__, arg2=type(args[1]).__name__)
468
488
  return args[0] <= args[1]
@@ -477,6 +497,8 @@ class LclCore:
477
497
  if args[0] is None or args[1] is None:
478
498
  return None
479
499
 
500
+ args = self._standarize_datatypes(args)
501
+
480
502
  if not isinstance(args[0], type(args[1])):
481
503
  return DIFFERENT_TYPES.format(arg1=type(args[0]).__name__, arg2=type(args[1]).__name__)
482
504
  return args[0] < args[1]
@@ -491,6 +513,8 @@ class LclCore:
491
513
  if args[0] is None or args[1] is None:
492
514
  return None
493
515
 
516
+ args = self._standarize_datatypes(args)
517
+
494
518
  if not isinstance(args[0], type(args[1])):
495
519
  return DIFFERENT_TYPES.format(arg1=type(args[0]).__name__, arg2=type(args[1]).__name__)
496
520
  return args[0] != args[1]
@@ -510,7 +534,7 @@ class LclCore:
510
534
  try:
511
535
  byte_array = bytes.fromhex(hexa)
512
536
  return byte_array.decode('ASCII')
513
- except Exception: # pylint: disable=broad-except
537
+ except Exception:
514
538
  return 'Invalid hex string'
515
539
 
516
540
  def STR_TO_HEX(self, *args: List[Any]) -> str | None:
@@ -533,7 +557,7 @@ class LclCore:
533
557
 
534
558
  try:
535
559
  return int(int(args[0], 16))
536
- except Exception: # pylint: disable=broad-except
560
+ except Exception:
537
561
  return 'Invalid hex string'
538
562
 
539
563
  def INT_TO_HEX(self, *args: List[Any]) -> str | None:
@@ -546,7 +570,7 @@ class LclCore:
546
570
 
547
571
  try:
548
572
  return hex(int(args[0]))[2:]
549
- except Exception: # pylint: disable=broad-except
573
+ except Exception:
550
574
  return 'Invalid int value'
551
575
 
552
576
  def TO_FLOAT(self, *args: List[Any]) -> str | None | float:
@@ -559,7 +583,7 @@ class LclCore:
559
583
 
560
584
  try:
561
585
  return float(args[0])
562
- except Exception: # pylint: disable=broad-except
586
+ except Exception:
563
587
  return f'Invalid arguments - must be real number, not {type(args[0]).__name__}'
564
588
 
565
589
  def IS_PARAMETER_PRESENT(self, *args: List[Any]) -> str | bool:
@@ -590,6 +614,8 @@ class LclCore:
590
614
  if args[0] is None or args[1] is None or args[2] is None:
591
615
  return None
592
616
 
617
+ args = self._standarize_datatypes(args)
618
+
593
619
  if not isinstance(args[0], type(args[1])):
594
620
  return DIFFERENT_TYPES_RANGES.format(
595
621
  arg1=type(args[0]).__name__,
@@ -607,6 +633,8 @@ class LclCore:
607
633
  if args[0] is None or args[1] is None or args[2] is None:
608
634
  return None
609
635
 
636
+ args = self._standarize_datatypes(args)
637
+
610
638
  if not isinstance(args[0], type(args[1])):
611
639
  return DIFFERENT_TYPES_RANGES.format(
612
640
  arg1=type(args[0]).__name__,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: layrz-sdk
3
- Version: 3.0.10
3
+ Version: 3.0.12
4
4
  Summary: Layrz SDK for Python
5
5
  Author-email: "Golden M, Inc." <software@goldenm.com>
6
6
  Maintainer-email: Kenny Mochizuki <kenny@goldenm.com>, Luis Reyes <lreyes@goldenm.com>, Kasen Li <kli@goldenm.com>
@@ -17,6 +17,7 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: requests
19
19
  Requires-Dist: xlsxwriter
20
+ Requires-Dist: tzdata
20
21
 
21
22
  # Layrz SDK
22
23
 
@@ -1,5 +1,5 @@
1
1
  layrz_sdk/__init__.py,sha256=OutylN0QazaeDVIA5NRDVyzwfYnZkAwVQzT-2F6iX2M,28
2
- layrz_sdk/entities/__init__.py,sha256=osv4J4OF2eIxe_h5u17y7nisdtNzluMD2L0xLpA05mI,2135
2
+ layrz_sdk/entities/__init__.py,sha256=Tlzwpbb4g75ny_ustZd3XSIeIynAkKe5llnFjhdvJgw,1388
3
3
  layrz_sdk/entities/broadcasts/__init__.py,sha256=E-Mmr-UjpD5Jxkut4UX7XMqi6IUEYxb_5NP3xyDM_cg,215
4
4
  layrz_sdk/entities/broadcasts/request.py,sha256=7r6-68ies6l5F0lVVpYg2aI2uTtn9UkK5yND3rrutLs,631
5
5
  layrz_sdk/entities/broadcasts/response.py,sha256=_LDggLwSGsuG0EAAwQqSIMmNu_WA3eL7S77-_HFHeRA,664
@@ -31,19 +31,19 @@ layrz_sdk/entities/charts/serie.py,sha256=xAEegIPBqg4opfZxpwVfPbNQNhgatjs6tAn-mv
31
31
  layrz_sdk/entities/charts/serie_type.py,sha256=P7FnH7vugn8IxOIqPk86POr0DNnWb9YLNROVxwNby3E,499
32
32
  layrz_sdk/entities/charts/table.py,sha256=G-MQu9UBDZGnG_AvcOqY-MOXgrQ87E4myUgRHX6g3rE,1631
33
33
  layrz_sdk/entities/charts/timeline.py,sha256=Udyv7Fe9_5MYinazRRpIKxzWl0q9Gw5I4XghXrTEqpM,3911
34
- layrz_sdk/entities/checkpoints/__init__.py,sha256=Bn_L1GbWcWUuBDpSVHKDqpjGYeIWDbPNI-_OnD-jrJQ,126
34
+ layrz_sdk/entities/checkpoints/__init__.py,sha256=LcSyaEJBaaGwvovNZ4ti_YGV2LoU3L7P2zUD7lBW5Cs,94
35
35
  layrz_sdk/entities/checkpoints/checkpoint.py,sha256=WtrwLZQy8Rf4czhDnpc1KsVNrL0tG8zQDYwEoFdcShk,1105
36
- layrz_sdk/entities/checkpoints/geofence.py,sha256=VWgfSoz6D1wshjK9w35Rnxg6_OhcIPKjInt0HTztzog,685
37
- layrz_sdk/entities/checkpoints/waypoint.py,sha256=WH8460Pd3SLXLViel4VqAiXGCq1WDlsxVBDxshhh_p8,1277
36
+ layrz_sdk/entities/checkpoints/waypoint.py,sha256=P7bK_xqGsUb2-pSD4WvN7bjXoee2Xi0y4yIOeZeo1A4,1303
38
37
  layrz_sdk/entities/events/__init__.py,sha256=6W9HsNBCOvVDJl9_1cnX_YlsZRHaZbNBtnYTmST5-WU,49
39
- layrz_sdk/entities/events/event.py,sha256=SsnCuH3PC9czk7_Bkv8Z6prEYRZI-5q2AqFlm25vsb0,1216
38
+ layrz_sdk/entities/events/event.py,sha256=_EfXT6pk6LozwU8IJY3eO6-aDNShUnMRej8s1Tc12Po,1536
40
39
  layrz_sdk/entities/formatting/__init__.py,sha256=cv-_epSLW_9RmUhs18caMo7XhvU12q-JvWPooYUNpJE,66
41
40
  layrz_sdk/entities/formatting/text_align.py,sha256=1kT8PE1WUjKhilgsQPU5XS5sSt76onWwfNNeKPvPv9E,501
42
- layrz_sdk/entities/general/__init__.py,sha256=qQSs86NUtxT3vC-gdEU05rBmKWRRQmOJcZBDaQgSUcw,218
41
+ layrz_sdk/entities/general/__init__.py,sha256=sSOiwoNQpmERpQi0d1AdXm1WYr9MVfFU5s-gCHag-s0,262
43
42
  layrz_sdk/entities/general/asset.py,sha256=wcqI-ogJEdhIrtDMavNgOTF3kep2Ipw7H95zFfq3lbw,1949
44
43
  layrz_sdk/entities/general/asset_operation_mode.py,sha256=LOAReg3qpx_xOGgBOZpHSZCrYxX9ssSUeWGib0n-97g,621
45
44
  layrz_sdk/entities/general/custom_field.py,sha256=6Bk9IWOzxcmo1kCTu3_0eg16cDyqZ0a_gAVCBtdxjjs,638
46
45
  layrz_sdk/entities/general/device.py,sha256=b15Oczfx7zXvR4T88Fh4EmUAB2WrYXgABmFBBsAE2tc,1013
46
+ layrz_sdk/entities/general/geofence.py,sha256=Ep6Rkjzk-L2VD-wrxF-0GvuWMGQl5ooD1A2QGFuI8zE,1115
47
47
  layrz_sdk/entities/general/sensor.py,sha256=N9smg5FmRQYuF1oGUxw9diJ4vVbFRg89v1h67Rk9RQM,647
48
48
  layrz_sdk/entities/general/user.py,sha256=cE-oasv3yObNdCAvb6w1Yoo-0U3_lhE6s12t4FY5Mwg,559
49
49
  layrz_sdk/entities/repcom/__init__.py,sha256=vXRvt0pzBIMeEGXNj8SEzejzMJg4t9uAakMMumKpg4U,61
@@ -61,9 +61,9 @@ layrz_sdk/entities/telemetry/position.py,sha256=sg7k6Etyu1ZtuFQfmfZq00_7WxRMmLgt
61
61
  layrz_sdk/helpers/__init__.py,sha256=v3WbYVr9ygyDtxEIi59kGVXuirNswhhkG4BQv5iESRo,72
62
62
  layrz_sdk/helpers/color.py,sha256=gfMuO627E7zdLXcK0WAgEwzmQOMrIdLFFv3ktI-UYbE,1129
63
63
  layrz_sdk/lcl/__init__.py,sha256=nmfOnbot49pvfR8xyqvs0tg7ZwzxunhWJbwA805w20M,67
64
- layrz_sdk/lcl/core.py,sha256=xaEcnP8aTuzFuzRNiS0tI_LZ6Hv4MTzZtYDKEAry-vo,22934
65
- layrz_sdk-3.0.10.dist-info/LICENSE,sha256=d5ZrU--lIPER7QByXDKcrtOTOMk1JvN_9FdYDuoWi7Y,1057
66
- layrz_sdk-3.0.10.dist-info/METADATA,sha256=CjWcXCvvV9Inq9QUcDX0I2iPfyh5_ORN83jAcds1yuM,1678
67
- layrz_sdk-3.0.10.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
68
- layrz_sdk-3.0.10.dist-info/top_level.txt,sha256=yUTMMzfdZ0HDWQH5TaSlFM4xtwmP1fSGxmlL1dmu4l4,10
69
- layrz_sdk-3.0.10.dist-info/RECORD,,
64
+ layrz_sdk/lcl/core.py,sha256=yG25WLCq_nnPiTgaCFCTteNL1-_mYKLc0VAwLT0D_6Q,23165
65
+ layrz_sdk-3.0.12.dist-info/LICENSE,sha256=d5ZrU--lIPER7QByXDKcrtOTOMk1JvN_9FdYDuoWi7Y,1057
66
+ layrz_sdk-3.0.12.dist-info/METADATA,sha256=D4MTxVjRaxX7M28_Lg-8slczvKSvjL_k1k6pnTrB-sI,1700
67
+ layrz_sdk-3.0.12.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
68
+ layrz_sdk-3.0.12.dist-info/top_level.txt,sha256=yUTMMzfdZ0HDWQH5TaSlFM4xtwmP1fSGxmlL1dmu4l4,10
69
+ layrz_sdk-3.0.12.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.1)
2
+ Generator: setuptools (70.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5