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

Files changed (123) hide show
  1. layrz_sdk/__init__.py +1 -1
  2. layrz_sdk/constants.py +5 -0
  3. layrz_sdk/entities/__init__.py +129 -73
  4. layrz_sdk/entities/asset.py +71 -0
  5. layrz_sdk/entities/{general/asset_operation_mode.py → asset_operation_mode.py} +31 -30
  6. layrz_sdk/entities/broadcast_request.py +12 -0
  7. layrz_sdk/entities/broadcast_response.py +12 -0
  8. layrz_sdk/entities/broadcast_result.py +20 -0
  9. layrz_sdk/entities/{broadcasts/status.py → broadcast_status.py} +28 -27
  10. layrz_sdk/entities/case.py +47 -0
  11. layrz_sdk/entities/case_ignored_status.py +26 -0
  12. layrz_sdk/entities/case_status.py +23 -0
  13. layrz_sdk/entities/charts/axis_config.py +15 -0
  14. layrz_sdk/entities/charts/{bar.py → bar_chart.py} +171 -208
  15. layrz_sdk/entities/charts/chart_alignment.py +27 -0
  16. layrz_sdk/entities/charts/chart_color.py +44 -0
  17. layrz_sdk/entities/charts/chart_configuration.py +10 -0
  18. layrz_sdk/entities/charts/chart_data_serie.py +19 -0
  19. layrz_sdk/entities/charts/chart_data_serie_type.py +28 -0
  20. layrz_sdk/entities/charts/chart_data_type.py +27 -0
  21. layrz_sdk/entities/charts/{render_technology.py → chart_render_technology.py} +30 -29
  22. layrz_sdk/entities/charts/{column.py → column_chart.py} +197 -236
  23. layrz_sdk/entities/charts/html_chart.py +34 -0
  24. layrz_sdk/entities/charts/{line.py → line_chart.py} +244 -282
  25. layrz_sdk/entities/charts/map_center_type.py +22 -0
  26. layrz_sdk/entities/charts/map_chart.py +104 -0
  27. layrz_sdk/entities/charts/map_point.py +22 -0
  28. layrz_sdk/entities/charts/number_chart.py +50 -0
  29. layrz_sdk/entities/charts/{pie.py → pie_chart.py} +127 -148
  30. layrz_sdk/entities/charts/radar_chart.py +77 -0
  31. layrz_sdk/entities/charts/{radial_bar.py → radial_bar_chart.py} +127 -148
  32. layrz_sdk/entities/charts/{scatter.py → scatter_chart.py} +206 -290
  33. layrz_sdk/entities/charts/scatter_serie.py +15 -0
  34. layrz_sdk/entities/charts/scatter_serie_item.py +8 -0
  35. layrz_sdk/entities/charts/table_chart.py +50 -0
  36. layrz_sdk/entities/charts/table_header.py +8 -0
  37. layrz_sdk/entities/charts/table_row.py +9 -0
  38. layrz_sdk/entities/charts/timeline_chart.py +75 -0
  39. layrz_sdk/entities/charts/timeline_serie.py +12 -0
  40. layrz_sdk/entities/charts/timeline_serie_item.py +12 -0
  41. layrz_sdk/entities/checkpoint.py +18 -0
  42. layrz_sdk/entities/comment.py +16 -0
  43. layrz_sdk/entities/custom_field.py +10 -0
  44. layrz_sdk/entities/custom_report_page.py +16 -0
  45. layrz_sdk/entities/device.py +13 -0
  46. layrz_sdk/entities/event.py +23 -0
  47. layrz_sdk/entities/geofence.py +11 -0
  48. layrz_sdk/entities/last_message.py +12 -0
  49. layrz_sdk/entities/message.py +23 -0
  50. layrz_sdk/entities/outbound_service.py +10 -0
  51. layrz_sdk/entities/position.py +101 -0
  52. layrz_sdk/entities/presence_type.py +16 -0
  53. layrz_sdk/entities/{reports/report.py → report.py} +257 -286
  54. layrz_sdk/entities/report_col.py +40 -0
  55. layrz_sdk/entities/report_configuration.py +8 -0
  56. layrz_sdk/entities/report_data_type.py +28 -0
  57. layrz_sdk/entities/{reports/format.py → report_format.py} +27 -26
  58. layrz_sdk/entities/report_header.py +43 -0
  59. layrz_sdk/entities/report_page.py +17 -0
  60. layrz_sdk/entities/report_row.py +28 -0
  61. layrz_sdk/entities/sensor.py +11 -0
  62. layrz_sdk/entities/{formatting/text_align.py → text_alignment.py} +26 -25
  63. layrz_sdk/entities/trigger.py +11 -0
  64. layrz_sdk/entities/user.py +10 -0
  65. layrz_sdk/entities/waypoint.py +18 -0
  66. layrz_sdk/helpers/__init__.py +8 -2
  67. layrz_sdk/helpers/color.py +41 -45
  68. layrz_sdk/lcl/__init__.py +7 -2
  69. layrz_sdk/lcl/core.py +832 -813
  70. layrz_sdk/py.typed +0 -0
  71. {layrz_sdk-3.0.13.dist-info → layrz_sdk-3.1.0.dist-info}/LICENSE +6 -6
  72. {layrz_sdk-3.0.13.dist-info → layrz_sdk-3.1.0.dist-info}/METADATA +48 -45
  73. layrz_sdk-3.1.0.dist-info/RECORD +75 -0
  74. {layrz_sdk-3.0.13.dist-info → layrz_sdk-3.1.0.dist-info}/WHEEL +1 -1
  75. layrz_sdk/entities/broadcasts/__init__.py +0 -6
  76. layrz_sdk/entities/broadcasts/request.py +0 -30
  77. layrz_sdk/entities/broadcasts/response.py +0 -30
  78. layrz_sdk/entities/broadcasts/result.py +0 -53
  79. layrz_sdk/entities/broadcasts/service.py +0 -28
  80. layrz_sdk/entities/cases/__init__.py +0 -4
  81. layrz_sdk/entities/cases/case.py +0 -120
  82. layrz_sdk/entities/cases/comment.py +0 -37
  83. layrz_sdk/entities/cases/trigger.py +0 -31
  84. layrz_sdk/entities/charts/__init__.py +0 -21
  85. layrz_sdk/entities/charts/alignment.py +0 -26
  86. layrz_sdk/entities/charts/color.py +0 -38
  87. layrz_sdk/entities/charts/configuration.py +0 -54
  88. layrz_sdk/entities/charts/data_type.py +0 -26
  89. layrz_sdk/entities/charts/exceptions.py +0 -29
  90. layrz_sdk/entities/charts/html.py +0 -44
  91. layrz_sdk/entities/charts/map.py +0 -179
  92. layrz_sdk/entities/charts/number.py +0 -52
  93. layrz_sdk/entities/charts/radar.py +0 -102
  94. layrz_sdk/entities/charts/serie.py +0 -56
  95. layrz_sdk/entities/charts/serie_type.py +0 -27
  96. layrz_sdk/entities/charts/table.py +0 -74
  97. layrz_sdk/entities/charts/timeline.py +0 -148
  98. layrz_sdk/entities/checkpoints/__init__.py +0 -4
  99. layrz_sdk/entities/checkpoints/checkpoint.py +0 -50
  100. layrz_sdk/entities/checkpoints/waypoint.py +0 -52
  101. layrz_sdk/entities/events/__init__.py +0 -2
  102. layrz_sdk/entities/events/event.py +0 -58
  103. layrz_sdk/entities/formatting/__init__.py +0 -2
  104. layrz_sdk/entities/general/__init__.py +0 -9
  105. layrz_sdk/entities/general/asset.py +0 -72
  106. layrz_sdk/entities/general/custom_field.py +0 -29
  107. layrz_sdk/entities/general/device.py +0 -45
  108. layrz_sdk/entities/general/geofence.py +0 -53
  109. layrz_sdk/entities/general/sensor.py +0 -31
  110. layrz_sdk/entities/general/user.py +0 -29
  111. layrz_sdk/entities/repcom/__init__.py +0 -2
  112. layrz_sdk/entities/repcom/transaction.py +0 -54
  113. layrz_sdk/entities/reports/__init__.py +0 -7
  114. layrz_sdk/entities/reports/col.py +0 -86
  115. layrz_sdk/entities/reports/header.py +0 -57
  116. layrz_sdk/entities/reports/page.py +0 -64
  117. layrz_sdk/entities/reports/row.py +0 -43
  118. layrz_sdk/entities/telemetry/__init__.py +0 -5
  119. layrz_sdk/entities/telemetry/last_message.py +0 -41
  120. layrz_sdk/entities/telemetry/message.py +0 -37
  121. layrz_sdk/entities/telemetry/position.py +0 -51
  122. layrz_sdk-3.0.13.dist-info/RECORD +0 -70
  123. {layrz_sdk-3.0.13.dist-info → layrz_sdk-3.1.0.dist-info}/top_level.txt +0 -0
@@ -1,26 +1,27 @@
1
- """Report formats"""
2
-
3
- from enum import Enum
4
-
5
-
6
- class ReportFormat(Enum):
7
- """
8
- Report format definition.
9
- """
10
-
11
- MICROSOFT_EXCEL = 'MICROSOFT_EXCEL'
12
- JSON = 'JSON'
13
- PDF = 'PDF'
14
-
15
- @property
16
- def _readable(self) -> str:
17
- """Readable"""
18
- return f'ReportFormat.{self.value}'
19
-
20
- def __str__(self) -> str:
21
- """Readable property"""
22
- return self._readable
23
-
24
- def __repr__(self) -> str:
25
- """Readable property"""
26
- return self._readable
1
+ """Report formats"""
2
+
3
+ import sys
4
+ from enum import Enum
5
+
6
+ if sys.version_info >= (3, 11):
7
+ from typing import Self
8
+ else:
9
+ from typing_extensions import Self
10
+
11
+
12
+ class ReportFormat(Enum):
13
+ """
14
+ Report format definition.
15
+ """
16
+
17
+ MICROSOFT_EXCEL = 'MICROSOFT_EXCEL'
18
+ JSON = 'JSON'
19
+ PDF = 'PDF'
20
+
21
+ def __str__(self: Self) -> str:
22
+ """Readable property"""
23
+ return self.name
24
+
25
+ def __repr__(self: Self) -> str:
26
+ """Readable property"""
27
+ return f'ReportFormat.{self.value}'
@@ -0,0 +1,43 @@
1
+ """Report header"""
2
+
3
+ import warnings
4
+ from typing import Any, Optional
5
+
6
+ from pydantic import BaseModel, Field, field_validator
7
+
8
+ from .text_alignment import TextAlignment
9
+
10
+
11
+ class ReportHeader(BaseModel):
12
+ """Report header entity"""
13
+
14
+ content: Any = Field(description='Header content')
15
+ color: str = Field(description='Header color', default='#ffffff')
16
+ text_color: Optional[str] = Field(description='Header text color', default=None)
17
+ align: TextAlignment = Field(description='Header text alignment', default=TextAlignment.CENTER)
18
+ bold: bool = Field(description='Bold text', default=False)
19
+ width: Optional[int] = Field(description='Header width', default=None)
20
+
21
+ @field_validator('text_color', mode='before')
22
+ def _validate_text_color(cls, value: Any) -> Any:
23
+ """Validate text color"""
24
+ if value is not None:
25
+ warnings.warn(
26
+ 'text_color is deprecated, the algorithm will calculate the rigth text color instead',
27
+ DeprecationWarning,
28
+ stacklevel=2,
29
+ )
30
+
31
+ return value
32
+
33
+ @field_validator('width', mode='before')
34
+ def _validate_width(cls, value: Any) -> Any:
35
+ """Validate width"""
36
+ if value is not None:
37
+ warnings.warn(
38
+ 'width is deprecated, the algorithm will calculate the rigth width instead',
39
+ DeprecationWarning,
40
+ stacklevel=2,
41
+ )
42
+
43
+ return value
@@ -0,0 +1,17 @@
1
+ """Report page"""
2
+
3
+ from typing import List
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+ from .report_header import ReportHeader
8
+ from .report_row import ReportRow
9
+
10
+
11
+ class ReportPage(BaseModel):
12
+ """Report page definition"""
13
+
14
+ name: str = Field(description='Name of the page. Length should be less than 60 characters')
15
+ headers: List[ReportHeader] = Field(description='List of report headers', default_factory=list)
16
+ rows: List[ReportRow] = Field(description='List of report rows', default_factory=list)
17
+ freeze_header: bool = Field(description='Freeze header', default=False)
@@ -0,0 +1,28 @@
1
+ """Report row"""
2
+
3
+ import warnings
4
+ from typing import Any, List, Optional
5
+
6
+ from pydantic import BaseModel, Field, field_validator
7
+
8
+ from .report_col import ReportCol
9
+
10
+
11
+ class ReportRow(BaseModel):
12
+ """Report row definition"""
13
+
14
+ content: List[ReportCol] = Field(description='List of report columns', default_factory=list)
15
+ height: Optional[float] = Field(description='Row height', default=None)
16
+ compact: bool = Field(description='Compact mode', default=False)
17
+
18
+ @field_validator('height', mode='before')
19
+ def _validate_height(cls, value: Any) -> Any:
20
+ """Validate height"""
21
+ if value is not None:
22
+ warnings.warn(
23
+ 'height is deprecated, the algorithm will calculate the rigth text color instead',
24
+ DeprecationWarning,
25
+ stacklevel=2,
26
+ )
27
+
28
+ return value
@@ -0,0 +1,11 @@
1
+ """Sensor entity"""
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class Sensor(BaseModel):
7
+ """Sensor entity"""
8
+
9
+ pk: int = Field(description='Defines the primary key of the sensor')
10
+ name: str = Field(description='Defines the name of the sensor')
11
+ slug: str = Field(description='Defines the slug of the sensor')
@@ -1,25 +1,26 @@
1
- """Text alignment"""
2
-
3
- from enum import Enum
4
-
5
-
6
- class TextAlignment(Enum):
7
- """Text alignment enum definition"""
8
-
9
- CENTER = 'center'
10
- LEFT = 'left'
11
- RIGHT = 'right'
12
- JUSTIFY = 'justify'
13
-
14
- @property
15
- def _readable(self) -> str | None | bool:
16
- """Readable"""
17
- return f'TextAlignment.{self.value}'
18
-
19
- def __str__(self) -> str | None | bool:
20
- """Readable property"""
21
- return self._readable
22
-
23
- def __repr__(self) -> str | None | bool:
24
- """Readable property"""
25
- return self._readable
1
+ """Text alignment"""
2
+
3
+ import sys
4
+ from enum import Enum
5
+
6
+ if sys.version_info >= (3, 11):
7
+ from typing import Self
8
+ else:
9
+ from typing_extensions import Self
10
+
11
+
12
+ class TextAlignment(Enum):
13
+ """Text alignment enum definition"""
14
+
15
+ CENTER = 'center'
16
+ LEFT = 'left'
17
+ RIGHT = 'right'
18
+ JUSTIFY = 'justify'
19
+
20
+ def __str__(self: Self) -> str:
21
+ """Readable property"""
22
+ return self.name
23
+
24
+ def __repr__(self: Self) -> str:
25
+ """Readable property"""
26
+ return f'TextAlignment.{self.value}'
@@ -0,0 +1,11 @@
1
+ """Trigger entity"""
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class Trigger(BaseModel):
7
+ """Trigger entity"""
8
+
9
+ pk: int = Field(description='Defines the primary key of the trigger')
10
+ name: str = Field(description='Defines the name of the trigger')
11
+ code: str = Field(description='Defines the code of the trigger')
@@ -0,0 +1,10 @@
1
+ """User entity"""
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class User(BaseModel):
7
+ """User entity"""
8
+
9
+ pk: int = Field(description='Defines the primary key of the user')
10
+ name: str = Field(description='Defines the name of the user')
@@ -0,0 +1,18 @@
1
+ """Waypoint entity"""
2
+
3
+ from datetime import datetime
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+ from .geofence import Geofence
8
+
9
+
10
+ class Waypoint(BaseModel):
11
+ """Waypoint entity definition"""
12
+
13
+ pk: int = Field(description='Waypoint ID')
14
+ geofence: Geofence = Field(description='Geofence object')
15
+ start_at: datetime = Field(description='Waypoint start date')
16
+ end_at: datetime = Field(description='Waypoint end date')
17
+ sequence_real: int = Field(description='Real sequence number')
18
+ sequence_ideal: int = Field(description='Ideal sequence number')
@@ -1,2 +1,8 @@
1
- """ Layrz SDK Helpers """
2
- from .color import convert_to_rgba, use_black
1
+ """Layrz SDK Helpers"""
2
+
3
+ from .color import convert_to_rgba, use_black
4
+
5
+ __all__ = [
6
+ 'convert_to_rgba',
7
+ 'use_black',
8
+ ]
@@ -1,45 +1,41 @@
1
- """
2
- Color helpers
3
- """
4
-
5
- from typing import Tuple
6
-
7
-
8
- def convert_to_rgba(hex_color: str) -> Tuple[int, int, int, int]:
9
- """
10
- Convert Hex (or Hexa) color to RGB (or RGBA) color
11
- Arguments
12
- ---------
13
- hex_color (str): Hex (or Hexa) color
14
- Returns
15
- -------
16
- tuple(r,g,b,a): Combination of colors. When the argument (hex_color) is Hex, the alpha channel is set to 1.
17
- """
18
-
19
- if not hex_color.startswith('#'):
20
- raise ValueError('Invalid color, must starts with #')
21
-
22
- hex_color = hex_color.replace('#', '')
23
- if len(hex_color) == 6:
24
- return tuple(int(hex_color[i : i + 2], 16) for i in (0, 2, 4)) + (1,)
25
-
26
- return tuple(int(hex_color[i : i + 2], 16) for i in (0, 2, 4, 6))
27
-
28
-
29
- def use_black(color: str) -> bool:
30
- """
31
- Use black
32
- Will return when the background color works well with black text color.
33
- Note: This method is not 100% accurate and will not work with alpha channel (Hexa color)
34
-
35
- Arguments
36
- ---------
37
- color (str): Hex color
38
-
39
- Returns
40
- -------
41
- boolean: True if use black
42
- """
43
- rgb = convert_to_rgba(color)
44
- a = 1 - (0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]) / 255
45
- return a < 0.5
1
+ """Color helpers"""
2
+
3
+ from typing import Tuple, TypeAlias, cast
4
+
5
+ Color: TypeAlias = Tuple[int, int, int, int]
6
+
7
+
8
+ def convert_to_rgba(hex_color: str) -> Color:
9
+ """
10
+ Convert Hex (or Hexa) color to RGB (or RGBA) color
11
+ :param hex_color: Hex color
12
+ :type hex_color: str
13
+ :return: RGB or RGBA color
14
+ :rtype: tuple
15
+ :raises ValueError: If the color is invalid
16
+ """
17
+
18
+ if not hex_color.startswith('#'):
19
+ raise ValueError('Invalid color, must starts with #')
20
+
21
+ hex_color = hex_color.replace('#', '')
22
+ if len(hex_color) == 6:
23
+ return cast(Color, tuple(int(hex_color[i : i + 2], 16) for i in (0, 2, 4)) + (1,))
24
+
25
+ return cast(Color, tuple(int(hex_color[i : i + 2], 16) for i in (0, 2, 4, 6)))
26
+
27
+
28
+ def use_black(color: str) -> bool:
29
+ """
30
+ Use black
31
+ Will return when the background color works well with black text color.
32
+ Note: This method is not 100% accurate and will not work with alpha channel (Hexa color)
33
+ :param color: Hex color
34
+ :type color: str
35
+ :return: True if the color works well with black text color
36
+ :rtype: bool
37
+ :raises ValueError: If the color is invalid
38
+ """
39
+ rgb = convert_to_rgba(color)
40
+ a = 1 - (0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]) / 255
41
+ return a < 0.5
layrz_sdk/lcl/__init__.py CHANGED
@@ -1,2 +1,7 @@
1
- """ Layrz Compute Language (LCL) SDK """
2
- from .core import LclCore
1
+ """Layrz Compute Language (LCL) SDK"""
2
+
3
+ from .core import LclCore
4
+
5
+ __all__ = [
6
+ 'LclCore',
7
+ ]