layrz-sdk 3.0.7__py3-none-any.whl → 3.0.9__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 (58) hide show
  1. layrz_sdk/entities/__init__.py +55 -9
  2. layrz_sdk/entities/broadcasts/request.py +5 -4
  3. layrz_sdk/entities/broadcasts/response.py +5 -4
  4. layrz_sdk/entities/broadcasts/result.py +6 -5
  5. layrz_sdk/entities/broadcasts/service.py +5 -4
  6. layrz_sdk/entities/broadcasts/status.py +4 -3
  7. layrz_sdk/entities/cases/case.py +13 -12
  8. layrz_sdk/entities/cases/comment.py +5 -4
  9. layrz_sdk/entities/cases/trigger.py +5 -4
  10. layrz_sdk/entities/charts/__init__.py +1 -1
  11. layrz_sdk/entities/charts/alignment.py +4 -3
  12. layrz_sdk/entities/charts/bar.py +9 -7
  13. layrz_sdk/entities/charts/color.py +5 -4
  14. layrz_sdk/entities/charts/column.py +9 -7
  15. layrz_sdk/entities/charts/configuration.py +9 -7
  16. layrz_sdk/entities/charts/data_type.py +4 -3
  17. layrz_sdk/entities/charts/exceptions.py +6 -5
  18. layrz_sdk/entities/charts/html.py +5 -3
  19. layrz_sdk/entities/charts/line.py +9 -8
  20. layrz_sdk/entities/charts/map.py +13 -13
  21. layrz_sdk/entities/charts/number.py +5 -3
  22. layrz_sdk/entities/charts/pie.py +9 -7
  23. layrz_sdk/entities/charts/radar.py +6 -4
  24. layrz_sdk/entities/charts/radial_bar.py +9 -7
  25. layrz_sdk/entities/charts/render_technology.py +4 -3
  26. layrz_sdk/entities/charts/scatter.py +12 -10
  27. layrz_sdk/entities/charts/serie.py +5 -3
  28. layrz_sdk/entities/charts/serie_type.py +4 -3
  29. layrz_sdk/entities/charts/table.py +15 -17
  30. layrz_sdk/entities/charts/timeline.py +7 -6
  31. layrz_sdk/entities/checkpoints/checkpoint.py +6 -5
  32. layrz_sdk/entities/checkpoints/geofence.py +5 -4
  33. layrz_sdk/entities/checkpoints/waypoint.py +5 -4
  34. layrz_sdk/entities/events/event.py +5 -4
  35. layrz_sdk/entities/formatting/text_align.py +4 -3
  36. layrz_sdk/entities/general/asset.py +11 -9
  37. layrz_sdk/entities/general/asset_operation_mode.py +4 -3
  38. layrz_sdk/entities/general/custom_field.py +5 -4
  39. layrz_sdk/entities/general/device.py +5 -4
  40. layrz_sdk/entities/general/sensor.py +5 -4
  41. layrz_sdk/entities/general/user.py +5 -4
  42. layrz_sdk/entities/repcom/transaction.py +3 -2
  43. layrz_sdk/entities/reports/col.py +9 -9
  44. layrz_sdk/entities/reports/format.py +11 -7
  45. layrz_sdk/entities/reports/header.py +12 -10
  46. layrz_sdk/entities/reports/page.py +10 -8
  47. layrz_sdk/entities/reports/report.py +130 -66
  48. layrz_sdk/entities/reports/row.py +7 -5
  49. layrz_sdk/entities/telemetry/message.py +6 -5
  50. layrz_sdk/entities/telemetry/position.py +5 -4
  51. layrz_sdk/helpers/color.py +6 -5
  52. layrz_sdk/lcl/core.py +131 -120
  53. {layrz_sdk-3.0.7.dist-info → layrz_sdk-3.0.9.dist-info}/METADATA +6 -1
  54. layrz_sdk-3.0.9.dist-info/RECORD +69 -0
  55. {layrz_sdk-3.0.7.dist-info → layrz_sdk-3.0.9.dist-info}/WHEEL +1 -1
  56. layrz_sdk-3.0.7.dist-info/RECORD +0 -69
  57. {layrz_sdk-3.0.7.dist-info → layrz_sdk-3.0.9.dist-info}/LICENSE +0 -0
  58. {layrz_sdk-3.0.7.dist-info → layrz_sdk-3.0.9.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,5 @@
1
1
  """ Chart exceptions """
2
+ from typing import Self
2
3
 
3
4
 
4
5
  class ChartException(BaseException):
@@ -6,24 +7,24 @@ class ChartException(BaseException):
6
7
  Chart Exception
7
8
  """
8
9
 
9
- def __init__(self, message: str) -> None:
10
+ def __init__(self: Self, message: str) -> None:
10
11
  """ Constructor """
11
12
  self._message = message
12
13
 
13
14
  @property
14
- def message(self) -> str:
15
+ def message(self: Self) -> str | None | bool:
15
16
  """ Message """
16
17
  return self._message
17
18
 
18
19
  @property
19
- def _readable(self) -> str:
20
+ def _readable(self: Self) -> str | None | bool:
20
21
  """ Readable """
21
22
  return f'ChartException: {self._message}'
22
23
 
23
- def __str__(self) -> str:
24
+ def __str__(self: Self) -> str | None | bool:
24
25
  """ Readable property """
25
26
  return self._readable
26
27
 
27
- def __repr__(self) -> str:
28
+ def __repr__(self: Self) -> str | None | bool:
28
29
  """ Readable property """
29
30
  return self._readable
@@ -1,4 +1,6 @@
1
1
  """ HTML chart """
2
+ from typing import Any, Self
3
+
2
4
  from .exceptions import ChartException
3
5
 
4
6
 
@@ -7,7 +9,7 @@ class HTMLChart:
7
9
  HTML chart configuration
8
10
  """
9
11
 
10
- def __init__(self, content='<p>N/A</p>', title='Chart'):
12
+ def __init__(self: Self, content: str ='<p>N/A</p>', title: str ='Chart') -> None:
11
13
  """
12
14
  Constructor
13
15
 
@@ -25,14 +27,14 @@ class HTMLChart:
25
27
  raise ChartException('title must be an instance of str')
26
28
  self.title = title
27
29
 
28
- def render(self):
30
+ def render(self: Self) -> Any:
29
31
  """
30
32
  Render chart to a Javascript Library.
31
33
  Currently only available for HTML.
32
34
  """
33
35
  return {'library': 'HTML', 'configuration': self._render_html()}
34
36
 
35
- def _render_html(self):
37
+ def _render_html(self: Self) -> Any:
36
38
  """
37
39
  Converts the configuration of the chart to HTML render engine.
38
40
  """
@@ -1,5 +1,6 @@
1
1
  """ Line chart """
2
2
  import logging
3
+ from typing import Any, List, Self
3
4
 
4
5
  from .alignment import ChartAlignment
5
6
  from .configuration import AxisConfig
@@ -11,6 +12,7 @@ from .serie_type import ChartDataSerieType
11
12
 
12
13
  log = logging.getLogger(__name__)
13
14
 
15
+
14
16
  class LineChart:
15
17
  """
16
18
  Line chart configuration
@@ -18,9 +20,9 @@ class LineChart:
18
20
  """
19
21
 
20
22
  def __init__(
21
- self,
23
+ self: Self,
22
24
  x_axis: ChartDataSerie,
23
- y_axis: list[ChartDataSerie],
25
+ y_axis: List[ChartDataSerie],
24
26
  title: str = 'Chart',
25
27
  align: ChartAlignment = ChartAlignment.CENTER,
26
28
  x_axis_config: AxisConfig = None,
@@ -70,7 +72,7 @@ class LineChart:
70
72
  raise ChartException('y_axis_config must be an instance of AxisConfig')
71
73
  self.y_axis_config = y_axis_config
72
74
 
73
- def render(self, technology: ChartRenderTechnology) -> dict | list[dict]:
75
+ def render(self: Self, technology: ChartRenderTechnology) -> Any:
74
76
  """
75
77
  Render chart to a graphic Library.
76
78
  We have two graphic libraries: GRAPHIC and CANVASJS.
@@ -106,8 +108,8 @@ class LineChart:
106
108
  'configuration': [f'Unsupported {technology}'],
107
109
  }
108
110
 
109
- def _render_syncfusion_flutter_charts(self) -> dict:
110
- """
111
+ def _render_syncfusion_flutter_charts(self: Self) -> Any:
112
+ """
111
113
  Converts the configuration of the chart to a Flutter library syncfusion_flutter_charts.
112
114
  """
113
115
  series = []
@@ -165,7 +167,7 @@ class LineChart:
165
167
  },
166
168
  }
167
169
 
168
- def _render_graphic(self) -> list[dict]:
170
+ def _render_graphic(self: Self) -> Any:
169
171
  """
170
172
  Converts the configuration of the chart to a Flutter library Graphic.
171
173
  """
@@ -196,7 +198,7 @@ class LineChart:
196
198
 
197
199
  return series
198
200
 
199
- def _render_canvasjs(self) -> dict:
201
+ def _render_canvasjs(self: Self) -> Any:
200
202
  """
201
203
  Converts the configuration of the chart to Javascript library CanvasJS.
202
204
  """
@@ -270,6 +272,5 @@ class LineChart:
270
272
  class AreaChart(LineChart):
271
273
  """
272
274
  Line chart
273
-
274
275
  Deprecation warning: This class will be removed in the next version. Use LineChart instead.
275
276
  """
@@ -1,5 +1,6 @@
1
1
  """ Map chart """
2
2
  from enum import Enum
3
+ from typing import Any, List, Self, Tuple
3
4
 
4
5
  from .exceptions import ChartException
5
6
  from .render_technology import ChartRenderTechnology
@@ -13,15 +14,15 @@ class MapCenterType(Enum):
13
14
  CONTAIN = 'CONTAIN'
14
15
 
15
16
  @property
16
- def _readable(self) -> str:
17
+ def _readable(self: Self) -> str | None | bool:
17
18
  """ Readable """
18
19
  return f'BroadcastStatus.{self.value}'
19
20
 
20
- def __str__(self) -> str:
21
+ def __str__(self: Self) -> str | None | bool:
21
22
  """ Readable property """
22
23
  return self._readable
23
24
 
24
- def __repr__(self) -> str:
25
+ def __repr__(self: Self) -> str | None | bool:
25
26
  """ Readable property """
26
27
  return self._readable
27
28
 
@@ -30,7 +31,7 @@ class MapPoint:
30
31
  """ Map point configuration """
31
32
 
32
33
  def __init__(
33
- self,
34
+ self: Self,
34
35
  latitude: float,
35
36
  longitude: float,
36
37
  label: str,
@@ -68,15 +69,14 @@ class MapChart:
68
69
  """
69
70
 
70
71
  def __init__(
71
- self,
72
- points: list[MapPoint],
72
+ self: Self,
73
+ points: List[MapPoint],
73
74
  title: str = 'Chart',
74
75
  center: MapCenterType = MapCenterType.CONTAIN,
75
- center_latlng: list[float] | tuple[float] = None,
76
- ):
76
+ center_latlng: List[float] | Tuple[float] = None,
77
+ ) -> None:
77
78
  """
78
79
  Constructor
79
-
80
80
  Args
81
81
  ----
82
82
  points : Points of the chart
@@ -96,11 +96,11 @@ class MapChart:
96
96
  raise ChartException('center must be an instance of MapCenterType')
97
97
  self.center = center
98
98
 
99
- if self.center == MapCenterType.FIXED and not isinstance(center_latlng, (list, tuple)):
99
+ if self.center == MapCenterType.FIXED and not isinstance(center_latlng, (List, Tuple)):
100
100
  raise ChartException('center_latlng must be an instance of list or tuple')
101
101
  self.center_latlng = center_latlng
102
102
 
103
- def render(self, technology: ChartRenderTechnology = ChartRenderTechnology.FLUTTER_MAP) -> dict:
103
+ def render(self: Self, technology: ChartRenderTechnology = ChartRenderTechnology.FLUTTER_MAP) -> Any:
104
104
  """
105
105
  Render chart to a graphic Library.
106
106
  We have two graphic libraries: FLUTTER_MAP and LEAFLET.
@@ -121,7 +121,7 @@ class MapChart:
121
121
  'configuration': [f'Unsupported {technology}'],
122
122
  }
123
123
 
124
- def _render_flutter_map(self) -> dict:
124
+ def _render_flutter_map(self: Self) -> Any:
125
125
  """
126
126
  Converts the configuration to the chart to Flutter Map engine.
127
127
  """
@@ -149,7 +149,7 @@ class MapChart:
149
149
 
150
150
  return config
151
151
 
152
- def _render_leaflet(self) -> dict:
152
+ def _render_leaflet(self: Self) -> Any:
153
153
  """
154
154
  Converts the configuration of the chart to Leaflet map engine.
155
155
  """
@@ -1,4 +1,6 @@
1
1
  """ Number chart """
2
+ from typing import Any, Self
3
+
2
4
  from .render_technology import ChartRenderTechnology
3
5
 
4
6
 
@@ -7,7 +9,7 @@ class NumberChart:
7
9
  Number chart configuration
8
10
  """
9
11
 
10
- def __init__(self, value: int | float, color: str, label: str) -> None:
12
+ def __init__(self: Self, value: float, color: str, label: str) -> None:
11
13
  """
12
14
  Constructor
13
15
 
@@ -21,7 +23,7 @@ class NumberChart:
21
23
  self.color = color
22
24
  self.label = label
23
25
 
24
- def render(self, technology: ChartRenderTechnology = ChartRenderTechnology.FLUTTER) -> dict:
26
+ def render(self: Self, technology: ChartRenderTechnology = ChartRenderTechnology.FLUTTER) -> Any:
25
27
  """
26
28
  Render chart to a graphic Library.
27
29
  """
@@ -38,7 +40,7 @@ class NumberChart:
38
40
  'configuration': [f'Unsupported {technology}'],
39
41
  }
40
42
 
41
- def _render_flutter(self) -> dict:
43
+ def _render_flutter(self: Self) -> Any:
42
44
  """
43
45
  Converts the configuration of the chart to a Flutter native components.
44
46
  """
@@ -1,4 +1,6 @@
1
1
  """ Pie chart """
2
+ from typing import Any, List, Self
3
+
2
4
  from .alignment import ChartAlignment
3
5
  from .exceptions import ChartException
4
6
  from .render_technology import ChartRenderTechnology
@@ -11,8 +13,8 @@ class PieChart:
11
13
  """
12
14
 
13
15
  def __init__(
14
- self,
15
- series: list[ChartDataSerie],
16
+ self: Self,
17
+ series: List[ChartDataSerie],
16
18
  title: str = 'Chart',
17
19
  align: ChartAlignment = ChartAlignment.CENTER,
18
20
  ) -> None:
@@ -39,9 +41,9 @@ class PieChart:
39
41
  self.align = align
40
42
 
41
43
  def render(
42
- self,
44
+ self: Self,
43
45
  technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
44
- ) -> dict | list[dict]:
46
+ ) -> Any:
45
47
  """
46
48
  Render chart to a graphic Library.
47
49
  We have two graphic libraries: GRAPHIC and CANVASJS.
@@ -76,7 +78,7 @@ class PieChart:
76
78
  'configuration': [f'Unsupported {technology}'],
77
79
  }
78
80
 
79
- def _render_syncfusion_flutter_charts(self) -> dict:
81
+ def _render_syncfusion_flutter_charts(self: Self) -> Any:
80
82
  """
81
83
  Converts the configuration of the chart to Syncfusion Flutter Charts.
82
84
  """
@@ -91,7 +93,7 @@ class PieChart:
91
93
 
92
94
  return {'series': series}
93
95
 
94
- def _render_graphic(self) -> list[dict]:
96
+ def _render_graphic(self: Self) -> Any:
95
97
  """
96
98
  Converts the configuration of the chart to a Flutter library Graphic.
97
99
  """
@@ -106,7 +108,7 @@ class PieChart:
106
108
 
107
109
  return series
108
110
 
109
- def _render_apexcharts(self) -> dict:
111
+ def _render_apexcharts(self: Self) -> Any:
110
112
  """
111
113
  Converts the configuration of the chart to Javascript library ApexCharts.
112
114
  """
@@ -1,4 +1,6 @@
1
1
  """ Radar chart """
2
+ from typing import Any, List, Self
3
+
2
4
  from .alignment import ChartAlignment
3
5
  from .exceptions import ChartException
4
6
  from .serie import ChartDataSerie
@@ -12,9 +14,9 @@ class RadarChart:
12
14
  """
13
15
 
14
16
  def __init__(
15
- self,
17
+ self: Self,
16
18
  x_axis: ChartDataSerie,
17
- y_axis: list[ChartDataSerie],
19
+ y_axis: List[ChartDataSerie],
18
20
  title: str = 'Chart',
19
21
  align: ChartAlignment = ChartAlignment.CENTER,
20
22
  ) -> None:
@@ -46,14 +48,14 @@ class RadarChart:
46
48
  raise ChartException('align must be an instance of ChartAlignment')
47
49
  self.align = align
48
50
 
49
- def render(self) -> dict:
51
+ def render(self: Self) -> Any:
50
52
  """
51
53
  Render chart to a Javascript Library.
52
54
  Currently only available for ApexCharts.
53
55
  """
54
56
  return {'library': 'APEXCHARTS', 'configuration': self._render_apexcharts()}
55
57
 
56
- def _render_apexcharts(self) -> dict:
58
+ def _render_apexcharts(self: Self) -> Any:
57
59
  """
58
60
  Converts the configuration of the chart to Javascript library ApexCharts.
59
61
  """
@@ -1,4 +1,6 @@
1
1
  """ Radial Bar chart """
2
+ from typing import Any, List, Self
3
+
2
4
  from .alignment import ChartAlignment
3
5
  from .exceptions import ChartException
4
6
  from .render_technology import ChartRenderTechnology
@@ -11,8 +13,8 @@ class RadialBarChart:
11
13
  """
12
14
 
13
15
  def __init__(
14
- self,
15
- series: list[ChartDataSerie],
16
+ self: Self,
17
+ series: List[ChartDataSerie],
16
18
  title: str = 'Chart',
17
19
  align: ChartAlignment = ChartAlignment.CENTER,
18
20
  ) -> None:
@@ -39,9 +41,9 @@ class RadialBarChart:
39
41
  self.align = align
40
42
 
41
43
  def render(
42
- self,
44
+ self: Self,
43
45
  technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
44
- ) -> dict | list[dict]:
46
+ ) -> Any:
45
47
  """
46
48
  Render chart to a graphic Library.
47
49
  We have two graphic libraries: GRAPHIC and CANVASJS.
@@ -76,7 +78,7 @@ class RadialBarChart:
76
78
  'configuration': [f'Unsupported {technology}'],
77
79
  }
78
80
 
79
- def _render_syncfusion_flutter_charts(self) -> dict:
81
+ def _render_syncfusion_flutter_charts(self: Self) -> Any:
80
82
  """
81
83
  Converts the configuration of the chart to Syncfusion Flutter Charts.
82
84
  """
@@ -91,7 +93,7 @@ class RadialBarChart:
91
93
 
92
94
  return {'series': series}
93
95
 
94
- def _render_graphic(self) -> list[dict]:
96
+ def _render_graphic(self: Self) -> Any:
95
97
  """
96
98
  Converts the configuration of the chart to a Flutter library Graphic.
97
99
  """
@@ -106,7 +108,7 @@ class RadialBarChart:
106
108
 
107
109
  return series
108
110
 
109
- def _render_apexcharts(self) -> dict:
111
+ def _render_apexcharts(self: Self) -> Any:
110
112
  """
111
113
  Converts the configuration of the chart to Javascript library ApexCharts.
112
114
  """
@@ -1,5 +1,6 @@
1
1
  """ Chart rendering technology / library """
2
2
  from enum import Enum
3
+ from typing import Self
3
4
 
4
5
 
5
6
  class ChartRenderTechnology(Enum):
@@ -14,14 +15,14 @@ class ChartRenderTechnology(Enum):
14
15
  FLUTTER = 'FLUTTER'
15
16
 
16
17
  @property
17
- def _readable(self) -> str:
18
+ def _readable(self: Self) -> str | None | bool:
18
19
  """ Readable """
19
20
  return f'ChartRenderTechnology.{self.value}'
20
21
 
21
- def __str__(self) -> str:
22
+ def __str__(self: Self) -> str | None | bool:
22
23
  """ Readable property """
23
24
  return self._readable
24
25
 
25
- def __repr__(self) -> str:
26
+ def __repr__(self: Self) -> str | None | bool:
26
27
  """ Readable property """
27
28
  return self._readable
@@ -1,4 +1,6 @@
1
1
  """ Scatter chart """
2
+ from typing import Any, List, Self
3
+
2
4
  from .alignment import ChartAlignment
3
5
  from .configuration import AxisConfig
4
6
  from .exceptions import ChartException
@@ -11,7 +13,7 @@ class ScatterSerieItem:
11
13
  Chart Data Serie Item for Scatter Charts
12
14
  """
13
15
 
14
- def __init__(self, x: int | float, y: int | float) -> None:
16
+ def __init__(self: Self, x: float, y: float) -> None:
15
17
  """
16
18
  Constructor
17
19
 
@@ -30,8 +32,8 @@ class ScatterSerie:
30
32
  """
31
33
 
32
34
  def __init__(
33
- self,
34
- data: list[ScatterSerieItem],
35
+ self: Self,
36
+ data: List[ScatterSerieItem],
35
37
  color: str,
36
38
  label: str,
37
39
  serie_type: ChartDataSerieType = ChartDataSerieType.SCATTER,
@@ -68,8 +70,8 @@ class ScatterChart:
68
70
  """
69
71
 
70
72
  def __init__(
71
- self,
72
- series: list[ScatterSerie],
73
+ self: Self,
74
+ series: List[ScatterSerie],
73
75
  title: str = 'Chart',
74
76
  align: ChartAlignment = ChartAlignment.CENTER,
75
77
  x_axis_config: AxisConfig = None,
@@ -112,9 +114,9 @@ class ScatterChart:
112
114
  self.y_axis_config = y_axis_config
113
115
 
114
116
  def render(
115
- self,
117
+ self: Self,
116
118
  technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
117
- ) -> dict:
119
+ ) -> Any:
118
120
  """
119
121
  Render chart to a graphic Library.
120
122
  We have two graphic libraries: GRAPHIC and APEXCHARTS.
@@ -149,7 +151,7 @@ class ScatterChart:
149
151
  'configuration': [f'Unsupported {technology}'],
150
152
  }
151
153
 
152
- def _render_syncfusion_flutter_charts(self) -> dict:
154
+ def _render_syncfusion_flutter_charts(self: Self) -> Any:
153
155
  """
154
156
  Converts the configuration of the chart to Flutter library Graphic.
155
157
  """
@@ -203,7 +205,7 @@ class ScatterChart:
203
205
  },
204
206
  }
205
207
 
206
- def _render_graphic(self) -> list[dict]:
208
+ def _render_graphic(self: Self) -> Any:
207
209
  """
208
210
  Converts the configuration of the chart to Flutter library Graphic.
209
211
  """
@@ -236,7 +238,7 @@ class ScatterChart:
236
238
 
237
239
  return series
238
240
 
239
- def _render_apexcharts(self) -> dict:
241
+ def _render_apexcharts(self: Self) -> Any:
240
242
  """
241
243
  Converts the configuration of the chart to Javascript library ApexCharts.
242
244
  """
@@ -1,4 +1,6 @@
1
1
  """ Chart Data Serie """
2
+ from typing import Any, Self
3
+
2
4
  from .data_type import ChartDataType
3
5
  from .exceptions import ChartException
4
6
  from .serie_type import ChartDataSerieType
@@ -10,14 +12,14 @@ class ChartDataSerie:
10
12
  """
11
13
 
12
14
  def __init__(
13
- self,
14
- data: list[float | int | bool],
15
+ self: Self,
16
+ data: Any,
15
17
  color: str = '#000000',
16
18
  label: str = '',
17
19
  serie_type: ChartDataSerieType = ChartDataSerieType.LINE,
18
20
  data_type: ChartDataType = ChartDataType.NUMBER,
19
21
  dashed: bool = False,
20
- ):
22
+ ) -> None:
21
23
  """
22
24
  Constructor
23
25
 
@@ -1,5 +1,6 @@
1
1
  """ Chart Serie type """
2
2
  from enum import Enum
3
+ from typing import Self
3
4
 
4
5
 
5
6
  class ChartDataSerieType(Enum):
@@ -12,14 +13,14 @@ class ChartDataSerieType(Enum):
12
13
  SCATTER = 'scatter'
13
14
 
14
15
  @property
15
- def _readable(self) -> str:
16
+ def _readable(self: Self) -> str | None | bool:
16
17
  """ Readable """
17
18
  return f'BroadcastStatus.{self.value}'
18
19
 
19
- def __str__(self) -> str:
20
+ def __str__(self: Self) -> str | None | bool:
20
21
  """ Readable property """
21
22
  return self._readable
22
23
 
23
- def __repr__(self) -> str:
24
+ def __repr__(self: Self) -> str | None | bool:
24
25
  """ Readable property """
25
26
  return self._readable
@@ -1,12 +1,15 @@
1
- """ Number chart """
1
+ """Number chart"""
2
+
3
+ from typing import Any, List, Self
4
+
2
5
  from .render_technology import ChartRenderTechnology
3
6
 
4
7
 
5
8
  class TableHeader:
6
- """ Table header chart configuration """
9
+ """Table header chart configuration"""
7
10
 
8
- def __init__(self, label: str, key: str) -> None:
9
- """ Constructor
11
+ def __init__(self: Self, label: str, key: str) -> None:
12
+ """Constructor
10
13
  ---
11
14
  Arguments
12
15
  - label : Label of the header
@@ -17,10 +20,10 @@ class TableHeader:
17
20
 
18
21
 
19
22
  class TableRow:
20
- """ Table row chart configuration """
23
+ """Table row chart configuration"""
21
24
 
22
- def __init__(self, data: dict) -> None:
23
- """ Constructor
25
+ def __init__(self: Self, data: Any) -> None:
26
+ """Constructor
24
27
  ---
25
28
  Arguments
26
29
  - data : Data of the row
@@ -33,7 +36,7 @@ class TableChart:
33
36
  Table chart configuration
34
37
  """
35
38
 
36
- def __init__(self, columns: list[TableHeader], rows: list[TableRow]) -> None:
39
+ def __init__(self: Self, columns: List[TableHeader], rows: List[TableRow]) -> None:
37
40
  """
38
41
  Constructor
39
42
  ---
@@ -44,7 +47,7 @@ class TableChart:
44
47
  self.columns = columns
45
48
  self.rows = rows
46
49
 
47
- def render(self, technology: ChartRenderTechnology = ChartRenderTechnology.FLUTTER) -> dict:
50
+ def render(self: Self, technology: ChartRenderTechnology = ChartRenderTechnology.FLUTTER) -> Any:
48
51
  """
49
52
  Render chart to a graphic Library.
50
53
  """
@@ -61,16 +64,11 @@ class TableChart:
61
64
  'configuration': [f'Unsupported {technology}'],
62
65
  }
63
66
 
64
- def _render_flutter(self) -> dict:
67
+ def _render_flutter(self: Self) -> Any:
65
68
  """
66
69
  Converts the configuration of the chart to a Flutter native components.
67
70
  """
68
71
  return {
69
- 'columns': [{
70
- 'key': column.key,
71
- 'label': column.label
72
- } for column in self.columns],
73
- 'rows': [{
74
- 'data': row.data
75
- } for row in self.rows],
72
+ 'columns': [{'key': column.key, 'label': column.label} for column in self.columns],
73
+ 'rows': [{'data': row.data} for row in self.rows],
76
74
  }
@@ -1,5 +1,6 @@
1
1
  """ Timeline chart entities """
2
2
  from datetime import datetime
3
+ from typing import Any, List, Self
3
4
 
4
5
  from .alignment import ChartAlignment
5
6
  from .exceptions import ChartException
@@ -10,7 +11,7 @@ class TimelineSerieItem:
10
11
  Chart Data Serie Item for Timeline Charts
11
12
  """
12
13
 
13
- def __init__(self, name: str, start_at: datetime, end_at: datetime, color: str) -> None:
14
+ def __init__(self: Self, name: str, start_at: datetime, end_at: datetime, color: str) -> None:
14
15
  """
15
16
  Constructor
16
17
  ----
@@ -42,7 +43,7 @@ class TimelineSerie:
42
43
  Chart Data Serie for Timeline charts
43
44
  """
44
45
 
45
- def __init__(self, data: list[TimelineSerieItem], label: str) -> None:
46
+ def __init__(self: Self, data: List[TimelineSerieItem], label: str) -> None:
46
47
  """
47
48
  Constructor
48
49
  ----
@@ -66,8 +67,8 @@ class TimelineChart:
66
67
  """
67
68
 
68
69
  def __init__(
69
- self,
70
- series: list[TimelineSerie],
70
+ self: Self,
71
+ series: List[TimelineSerie],
71
72
  title: str = 'Chart',
72
73
  align: ChartAlignment = ChartAlignment.CENTER,
73
74
  ) -> None:
@@ -93,14 +94,14 @@ class TimelineChart:
93
94
  raise ChartException('align must be an instance of ChartAlignment')
94
95
  self.align = align
95
96
 
96
- def render(self) -> dict:
97
+ def render(self: Self) -> Any:
97
98
  """
98
99
  Render chart to a Javascript Library.
99
100
  Currently only available for ApexCharts.
100
101
  """
101
102
  return {'library': 'APEXCHARTS', 'configuration': self._render_apexcharts()}
102
103
 
103
- def _render_apexcharts(self) -> dict:
104
+ def _render_apexcharts(self: Self) -> Any:
104
105
  """
105
106
  Converts the configuration of the chart to Javascript library ApexCharts.
106
107
  """