layrz-sdk 3.0.14__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 -820
  70. layrz_sdk/py.typed +0 -0
  71. {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.0.dist-info}/LICENSE +6 -6
  72. {layrz_sdk-3.0.14.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.14.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.14.dist-info/RECORD +0 -70
  123. {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.0.dist-info}/top_level.txt +0 -0
@@ -1,148 +1,127 @@
1
- """Radial Bar chart"""
2
-
3
- from typing import Any, List
4
-
5
- from .alignment import ChartAlignment
6
- from .exceptions import ChartException
7
- from .render_technology import ChartRenderTechnology
8
- from .serie import ChartDataSerie
9
-
10
-
11
- class RadialBarChart:
12
- """
13
- Radial Bar chart configuration
14
- """
15
-
16
- def __init__(
17
- self,
18
- series: List[ChartDataSerie],
19
- title: str = 'Chart',
20
- align: ChartAlignment = ChartAlignment.CENTER,
21
- ) -> None:
22
- """
23
- Constructor
24
- ----
25
- Arguments
26
- series : Defines the series of the chart, uses the ChartDataSerie class.
27
- Please read the documentation to more information.
28
- title : Title of the chart.
29
- align : Alignment of the chart.
30
- """
31
- for i, serie in enumerate(series):
32
- if not isinstance(serie, ChartDataSerie):
33
- raise ChartException(f'Y Axis serie {i} must be an instance of ChartDataSerie')
34
- self.series = series
35
-
36
- if not isinstance(title, str):
37
- raise ChartException('title must be an instance of str')
38
- self.title = title
39
-
40
- if not isinstance(align, ChartAlignment):
41
- raise ChartException('align must be an instance of ChartAlignment')
42
- self.align = align
43
-
44
- def render(
45
- self,
46
- technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
47
- ) -> Any:
48
- """
49
- Render chart to a graphic Library.
50
- We have two graphic libraries: GRAPHIC and CANVASJS.
51
-
52
- GRAPHIC is a Flutter chart library. To return this option, use the parameter use_new_definition=True.
53
- CANVASJS is a Javascript chart library. This is the default option.
54
- """
55
- if technology == ChartRenderTechnology.GRAPHIC:
56
- return {
57
- 'library': 'GRAPHIC',
58
- 'chart': 'RADIALBAR',
59
- 'configuration': self._render_graphic(),
60
- }
61
-
62
- if technology == ChartRenderTechnology.APEX_CHARTS:
63
- return {
64
- 'library': 'APEXCHARTS',
65
- 'chart': 'RADIALBAR',
66
- 'configuration': self._render_apexcharts(),
67
- }
68
-
69
- if technology == ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS:
70
- return {
71
- 'library': 'SYNCFUSION_FLUTTER_CHARTS',
72
- 'chart': 'RADIALBAR',
73
- 'configuration': self._render_syncfusion_flutter_charts(),
74
- }
75
-
76
- return {
77
- 'library': 'FLUTTER',
78
- 'chart': 'TEXT',
79
- 'configuration': [f'Unsupported {technology}'],
80
- }
81
-
82
- def _render_syncfusion_flutter_charts(self) -> Any:
83
- """
84
- Converts the configuration of the chart to Syncfusion Flutter Charts.
85
- """
86
- series = []
87
-
88
- for serie in self.series:
89
- series.append(
90
- {
91
- 'label': serie.label,
92
- 'color': serie.color,
93
- 'value': serie.data[0],
94
- }
95
- )
96
-
97
- return {'series': series}
98
-
99
- def _render_graphic(self) -> Any:
100
- """
101
- Converts the configuration of the chart to a Flutter library Graphic.
102
- """
103
- series = []
104
-
105
- for serie in self.series:
106
- series.append(
107
- {
108
- 'group': serie.label,
109
- 'color': serie.color,
110
- 'value': serie.data[0],
111
- }
112
- )
113
-
114
- return series
115
-
116
- def _render_apexcharts(self) -> Any:
117
- """
118
- Converts the configuration of the chart to Javascript library ApexCharts.
119
- """
120
-
121
- series = []
122
- colors = []
123
- labels = []
124
-
125
- for serie in self.series:
126
- series.append(serie.data[0])
127
- colors.append(serie.color)
128
- labels.append(serie.label)
129
-
130
- config = {
131
- 'series': series,
132
- 'colors': colors,
133
- 'labels': labels,
134
- 'title': {
135
- 'text': self.title,
136
- 'align': self.align.value,
137
- 'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
138
- },
139
- 'chart': {
140
- 'type': 'radialBar',
141
- 'animations': {'enabled': False},
142
- 'toolbar': {'show': False},
143
- 'zoom': {'enabled': False},
144
- },
145
- 'dataLabels': {'enabled': True},
146
- }
147
-
148
- return config
1
+ """Radial Bar chart"""
2
+
3
+ import sys
4
+ from typing import Any, Dict, List
5
+
6
+ from pydantic import BaseModel, Field
7
+
8
+ from .chart_alignment import ChartAlignment
9
+ from .chart_data_serie import ChartDataSerie
10
+ from .chart_render_technology import ChartRenderTechnology
11
+
12
+ if sys.version_info >= (3, 11):
13
+ from typing import Self
14
+ else:
15
+ from typing_extensions import Self
16
+
17
+
18
+ class RadialBarChart(BaseModel):
19
+ """Radial Bar chart configuration"""
20
+
21
+ series: List[ChartDataSerie] = Field(description='List of series to be displayed in the chart', default_factory=list)
22
+ title: str = Field(description='Title of the chart', default='Chart')
23
+ align: ChartAlignment = Field(description='Alignment of the chart', default=ChartAlignment.CENTER)
24
+
25
+ def render(
26
+ self: Self,
27
+ technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
28
+ ) -> Dict[str, Any]:
29
+ """
30
+ Render chart to a graphic Library.
31
+ :param technology: The technology to use to render the chart.
32
+ :return: The configuration of the chart.
33
+ """
34
+ if technology == ChartRenderTechnology.GRAPHIC:
35
+ return {
36
+ 'library': 'GRAPHIC',
37
+ 'chart': 'RADIALBAR',
38
+ 'configuration': self._render_graphic(),
39
+ }
40
+
41
+ if technology == ChartRenderTechnology.APEX_CHARTS:
42
+ return {
43
+ 'library': 'APEXCHARTS',
44
+ 'chart': 'RADIALBAR',
45
+ 'configuration': self._render_apexcharts(),
46
+ }
47
+
48
+ if technology == ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS:
49
+ return {
50
+ 'library': 'SYNCFUSION_FLUTTER_CHARTS',
51
+ 'chart': 'RADIALBAR',
52
+ 'configuration': self._render_syncfusion_flutter_charts(),
53
+ }
54
+
55
+ return {
56
+ 'library': 'FLUTTER',
57
+ 'chart': 'TEXT',
58
+ 'configuration': [f'Unsupported {technology}'],
59
+ }
60
+
61
+ def _render_syncfusion_flutter_charts(self) -> Any:
62
+ """
63
+ Converts the configuration of the chart to Syncfusion Flutter Charts.
64
+ """
65
+ series = []
66
+
67
+ for serie in self.series:
68
+ series.append(
69
+ {
70
+ 'label': serie.label,
71
+ 'color': serie.color,
72
+ 'value': serie.data[0],
73
+ }
74
+ )
75
+
76
+ return {'series': series}
77
+
78
+ def _render_graphic(self) -> Any:
79
+ """
80
+ Converts the configuration of the chart to a Flutter library Graphic.
81
+ """
82
+ series = []
83
+
84
+ for serie in self.series:
85
+ series.append(
86
+ {
87
+ 'group': serie.label,
88
+ 'color': serie.color,
89
+ 'value': serie.data[0],
90
+ }
91
+ )
92
+
93
+ return series
94
+
95
+ def _render_apexcharts(self) -> Any:
96
+ """
97
+ Converts the configuration of the chart to Javascript library ApexCharts.
98
+ """
99
+
100
+ series = []
101
+ colors = []
102
+ labels = []
103
+
104
+ for serie in self.series:
105
+ series.append(serie.data[0])
106
+ colors.append(serie.color)
107
+ labels.append(serie.label)
108
+
109
+ config = {
110
+ 'series': series,
111
+ 'colors': colors,
112
+ 'labels': labels,
113
+ 'title': {
114
+ 'text': self.title,
115
+ 'align': self.align.value,
116
+ 'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
117
+ },
118
+ 'chart': {
119
+ 'type': 'radialBar',
120
+ 'animations': {'enabled': False},
121
+ 'toolbar': {'show': False},
122
+ 'zoom': {'enabled': False},
123
+ },
124
+ 'dataLabels': {'enabled': True},
125
+ }
126
+
127
+ return config