layrz-sdk 3.1.49__py3-none-any.whl → 4.0.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 (78) hide show
  1. layrz_sdk/entities/action.py +5 -21
  2. layrz_sdk/entities/action_geofence_ownership.py +3 -8
  3. layrz_sdk/entities/action_kind.py +3 -8
  4. layrz_sdk/entities/action_subkind.py +3 -8
  5. layrz_sdk/entities/asset.py +14 -9
  6. layrz_sdk/entities/asset_constants.py +1 -1
  7. layrz_sdk/entities/asset_operation_mode.py +3 -8
  8. layrz_sdk/entities/ats_exit_history.py +16 -32
  9. layrz_sdk/entities/ats_possible_exit.py +15 -18
  10. layrz_sdk/entities/ats_reception.py +4 -3
  11. layrz_sdk/entities/broadcast/service.py +1 -1
  12. layrz_sdk/entities/broadcast/status.py +3 -8
  13. layrz_sdk/entities/case.py +2 -8
  14. layrz_sdk/entities/case_ignored_status.py +3 -8
  15. layrz_sdk/entities/case_status.py +3 -8
  16. layrz_sdk/entities/charts/bar_chart.py +1 -7
  17. layrz_sdk/entities/charts/chart_alignment.py +3 -8
  18. layrz_sdk/entities/charts/chart_color.py +3 -8
  19. layrz_sdk/entities/charts/chart_data_serie_type.py +6 -11
  20. layrz_sdk/entities/charts/chart_data_type.py +3 -8
  21. layrz_sdk/entities/charts/chart_render_technology.py +3 -8
  22. layrz_sdk/entities/charts/column_chart.py +3 -8
  23. layrz_sdk/entities/charts/html_chart.py +1 -7
  24. layrz_sdk/entities/charts/line_chart.py +1 -7
  25. layrz_sdk/entities/charts/map_center_type.py +3 -8
  26. layrz_sdk/entities/charts/map_chart.py +1 -7
  27. layrz_sdk/entities/charts/number_chart.py +1 -7
  28. layrz_sdk/entities/charts/pie_chart.py +1 -7
  29. layrz_sdk/entities/charts/radar_chart.py +1 -7
  30. layrz_sdk/entities/charts/radial_bar_chart.py +1 -7
  31. layrz_sdk/entities/charts/scatter_chart.py +1 -7
  32. layrz_sdk/entities/charts/table_chart.py +1 -7
  33. layrz_sdk/entities/charts/timeline_chart.py +1 -7
  34. layrz_sdk/entities/checkpoint.py +1 -2
  35. layrz_sdk/entities/command_series_ticket.py +1 -1
  36. layrz_sdk/entities/comment.py +1 -1
  37. layrz_sdk/entities/custom_field.py +2 -0
  38. layrz_sdk/entities/destination_phone.py +1 -6
  39. layrz_sdk/entities/device.py +1 -1
  40. layrz_sdk/entities/event.py +1 -1
  41. layrz_sdk/entities/function.py +31 -14
  42. layrz_sdk/entities/geofence.py +1 -1
  43. layrz_sdk/entities/geofence_category.py +3 -8
  44. layrz_sdk/entities/message.py +24 -6
  45. layrz_sdk/entities/modbus/schema.py +2 -2
  46. layrz_sdk/entities/modbus/status.py +2 -2
  47. layrz_sdk/entities/notification_type.py +3 -8
  48. layrz_sdk/entities/operation.py +25 -9
  49. layrz_sdk/entities/operation_case_payload.py +1 -7
  50. layrz_sdk/entities/operation_payload.py +4 -11
  51. layrz_sdk/entities/operation_type.py +3 -8
  52. layrz_sdk/entities/outbound_service.py +1 -1
  53. layrz_sdk/entities/platform.py +3 -8
  54. layrz_sdk/entities/position.py +8 -14
  55. layrz_sdk/entities/presence_type.py +3 -8
  56. layrz_sdk/entities/preset.py +1 -2
  57. layrz_sdk/entities/report.py +1 -7
  58. layrz_sdk/entities/report_col.py +1 -7
  59. layrz_sdk/entities/report_data_type.py +3 -8
  60. layrz_sdk/entities/report_format.py +3 -8
  61. layrz_sdk/entities/request_type.py +3 -8
  62. layrz_sdk/entities/sensor.py +1 -1
  63. layrz_sdk/entities/sound_effect.py +3 -8
  64. layrz_sdk/entities/telemetry/assetmessage.py +4 -11
  65. layrz_sdk/entities/telemetry/devicemessage.py +8 -26
  66. layrz_sdk/entities/text_alignment.py +3 -8
  67. layrz_sdk/entities/trigger.py +1 -1
  68. layrz_sdk/entities/trigger_kind.py +6 -11
  69. layrz_sdk/entities/user.py +1 -1
  70. layrz_sdk/entities/waypoint.py +8 -3
  71. layrz_sdk/entities/weekday.py +3 -8
  72. {layrz_sdk-3.1.49.dist-info → layrz_sdk-4.0.0.dist-info}/METADATA +2 -5
  73. layrz_sdk-4.0.0.dist-info/RECORD +114 -0
  74. layrz_sdk/backwards.py +0 -6
  75. layrz_sdk-3.1.49.dist-info/RECORD +0 -115
  76. {layrz_sdk-3.1.49.dist-info → layrz_sdk-4.0.0.dist-info}/WHEEL +0 -0
  77. {layrz_sdk-3.1.49.dist-info → layrz_sdk-4.0.0.dist-info}/licenses/LICENSE +0 -0
  78. {layrz_sdk-3.1.49.dist-info → layrz_sdk-4.0.0.dist-info}/top_level.txt +0 -0
@@ -23,29 +23,16 @@ class Action(BaseModel):
23
23
  },
24
24
  }
25
25
 
26
- pk: int = Field(
27
- ...,
28
- description='Primary key of the action entity',
29
- alias='id',
30
- )
31
- name: str = Field(
32
- ...,
33
- description='Name of the action',
34
- )
35
- kind: ActionKind = Field(
36
- ...,
37
- description='Kind of the action',
38
- )
26
+ pk: int = Field(..., description='Primary key of the action entity', alias='id')
27
+ name: str = Field(..., description='Name of the action')
28
+ kind: ActionKind = Field(..., description='Kind of the action')
39
29
 
40
30
  command_id: int | None = Field(
41
31
  default=None,
42
32
  description='Tag ID associated with the action to send commands to primary devices',
43
33
  )
44
34
 
45
- subkind: ActionSubKind = Field(
46
- default=ActionSubKind.UNUSED,
47
- description='Subkind of the action',
48
- )
35
+ subkind: ActionSubKind = Field(default=ActionSubKind.UNUSED, description='Subkind of the action')
49
36
 
50
37
  wait_for_image: bool = Field(
51
38
  default=False,
@@ -80,7 +67,4 @@ class Action(BaseModel):
80
67
  description='Ownership of the new geofence created by the action',
81
68
  )
82
69
 
83
- owner_id: int | None = Field(
84
- default=None,
85
- description='Owner ID',
86
- )
70
+ owner_id: int | None = Field(default=None, description='Owner ID')
@@ -1,15 +1,10 @@
1
1
  """Action geofence ownership"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class ActionGeofenceOwnership(str, Enum):
7
+ class ActionGeofenceOwnership(StrEnum):
13
8
  """
14
9
  Action geofence ownership definition
15
10
  """
@@ -1,15 +1,10 @@
1
1
  """Action kind"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class ActionKind(str, Enum):
7
+ class ActionKind(StrEnum):
13
8
  """
14
9
  Action kind definition
15
10
  """
@@ -1,15 +1,10 @@
1
1
  """Action sub kind"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class ActionSubKind(str, Enum):
7
+ class ActionSubKind(StrEnum):
13
8
  """
14
9
  Action sub kind definition
15
10
  """
@@ -1,15 +1,9 @@
1
1
  """Asset Entity"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
5
4
 
6
5
  from pydantic import BaseModel, Field, model_validator
7
6
 
8
- if sys.version_info >= (3, 11):
9
- from typing import Self
10
- else:
11
- from typing_extensions import Self
12
-
13
7
  from .asset_contact import AssetContact
14
8
  from .asset_operation_mode import AssetOperationMode
15
9
  from .custom_field import CustomField
@@ -21,14 +15,20 @@ from .static_position import StaticPosition
21
15
  class Asset(BaseModel):
22
16
  """Asset entity definition"""
23
17
 
24
- pk: int = Field(description='Defines the primary key of the asset')
18
+ model_config = {
19
+ 'json_encoders': {
20
+ AssetOperationMode: lambda v: v.value,
21
+ }
22
+ }
23
+
24
+ pk: int = Field(description='Defines the primary key of the asset', alias='id')
25
25
  name: str = Field(description='Defines the name of the asset')
26
26
  vin: str | None = Field(
27
27
  default=None,
28
28
  description='Defines the serial number of the asset, may be an VIN, or any other unique identifier',
29
29
  )
30
30
  plate: str | None = Field(default=None, description='Defines the plate number of the asset')
31
- asset_type: int | None = Field(description='Defines the type of the asset', alias='kind_id', default=None)
31
+ kind_id: int | None = Field(description='Defines the type of the asset', default=None)
32
32
  operation_mode: AssetOperationMode = Field(description='Defines the operation mode of the asset')
33
33
  sensors: list[Sensor] = Field(default_factory=list, description='Defines the list of sensors of the asset')
34
34
  custom_fields: list[CustomField] = Field(
@@ -85,3 +85,8 @@ class Asset(BaseModel):
85
85
  default=None,
86
86
  description='Owner ID',
87
87
  )
88
+
89
+ @property
90
+ def asset_type(self: Self) -> int | None:
91
+ """Get asset type"""
92
+ return self.kind_id
@@ -15,7 +15,7 @@ class AssetConstants(BaseModel):
15
15
  }
16
16
 
17
17
  distance_traveled: float = Field(default=0.0, description='Total distance traveled by the asset in meters')
18
- primary_device: str = Field(default='N/a', description='Primary device associated with the asset')
18
+ primary_device: str = Field(default='N/A', description='Primary device associated with the asset')
19
19
  elapsed_time: timedelta = Field(
20
20
  default=timedelta(seconds=0),
21
21
  description='Total elapsed time for the asset in seconds',
@@ -1,15 +1,10 @@
1
1
  """Asset Operation Mode"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class AssetOperationMode(str, Enum):
7
+ class AssetOperationMode(StrEnum):
13
8
  """
14
9
  Asset Operation mode definition
15
10
  It's an enum of the operation mode of the asset.
@@ -1,19 +1,22 @@
1
1
  """Exit Execution History"""
2
2
 
3
3
  from datetime import datetime
4
- from typing import Literal, Optional
4
+ from typing import Literal
5
5
 
6
6
  from pydantic import (
7
7
  BaseModel,
8
8
  ConfigDict,
9
9
  Field,
10
- PositiveInt, # useful if you later want a non-nullable positive int
11
- conint,
12
10
  )
13
11
 
14
12
 
15
13
  class AtsExitExecutionHistory(BaseModel):
16
- pk: int = Field(description='Primary key of the Exit Execution History')
14
+ model_config = {
15
+ 'json_encoders': {
16
+ datetime: lambda v: v.timestamp(),
17
+ }
18
+ }
19
+ pk: int = Field(description='Primary key of the Exit Execution History', alias='id')
17
20
 
18
21
  from_asset: int = Field(
19
22
  description='ID of the asset from which the exit is initiated',
@@ -22,37 +25,18 @@ class AtsExitExecutionHistory(BaseModel):
22
25
  description='ID of the asset to which the exit is directed',
23
26
  )
24
27
 
25
- status: Literal['PENDING', 'FAILED', 'SUCCESS'] = Field(
26
- default='PENDING',
27
- )
28
- from_app: Optional[Literal['ATSWEB', 'ATSMOBILE', 'NFC']] = Field(
29
- default=None,
30
- description='Application from which the exit was initiated',
31
- )
32
-
33
- error_response: Optional[str] = Field(
34
- default=None,
35
- description='Error response received during the exit process',
36
- )
28
+ status: Literal['PENDING', 'FAILED', 'SUCCESS'] = Field(default='PENDING')
37
29
 
38
- generated_by: int = Field(
39
- description='ID of the user or system that initiated the exit',
40
- )
41
-
42
- queue_id: Optional[int] = Field(
43
- default=None,
44
- description='ID of the queue associated with the exit',
45
- )
46
- to_asset_mileage: Optional[float] = Field(
30
+ from_app: Literal['ATSWEB', 'ATSMOBILE', 'NFC'] | None = Field(
47
31
  default=None,
48
- description='Mileage of the asset to which the exit is directed',
32
+ description='Application from which the exit was initiated',
49
33
  )
50
34
 
51
- created_at: datetime = Field(
52
- description='Timestamp when the exit was created',
53
- )
54
- updated_at: datetime = Field(
55
- description='Timestamp when the exit was last updated',
56
- )
35
+ error_response: str | None = Field(default=None, description='Error response received during the exit process')
36
+ generated_by: int = Field(description='ID of the user or system that initiated the exit')
37
+ queue_id: int | None = Field(default=None, description='ID of the queue associated with the exit')
38
+ to_asset_mileage: float | None = Field(default=None, description='Mileage of the asset to which the exit is directed')
57
39
 
40
+ created_at: datetime = Field(description='Timestamp when the exit was created')
41
+ updated_at: datetime = Field(description='Timestamp when the exit was last updated')
58
42
  model_config = ConfigDict(from_attributes=True)
@@ -1,34 +1,33 @@
1
1
  """Ats Exit entity"""
2
2
 
3
3
  from datetime import datetime
4
- from typing import Optional
5
4
 
6
- from pydantic import (
7
- BaseModel,
8
- ConfigDict,
9
- Field,
10
- PositiveInt, # useful if you later want a non-nullable positive int
11
- conint,
12
- )
5
+ from pydantic import BaseModel, Field
13
6
 
14
7
 
15
8
  class AtsPossibleExit(BaseModel):
16
9
  """AtsPossibleExit entity"""
17
10
 
18
- pk: int = Field(description='Defines the primary key of the AtsPossibleExit')
11
+ model_config = {
12
+ 'json_encoders': {
13
+ datetime: lambda v: v.timestamp(),
14
+ }
15
+ }
19
16
 
20
- # Nullable “positive big integer” identifier
21
- identifier: Optional[conint(ge=0)] = Field( # type: ignore
17
+ pk: int = Field(description='Defines the primary key of the AtsPossibleExit', alias='id')
18
+
19
+ identifier: int | None = Field(
22
20
  default=None,
23
21
  description='Nullable positive big integer identifier for the exit',
22
+ ge=0,
24
23
  )
25
24
 
26
25
  # Volume / gauge snapshots
27
- initial_tank_volume: Optional[float] = Field(
26
+ initial_tank_volume: float | None = Field(
28
27
  default=None,
29
28
  description='Initial tank volume in liters',
30
29
  )
31
- initial_fluxometer: Optional[float] = Field(
30
+ initial_fluxometer: float | None = Field(
32
31
  default=None,
33
32
  description='Initial fluxometer reading in liters',
34
33
  )
@@ -56,7 +55,7 @@ class AtsPossibleExit(BaseModel):
56
55
  default_factory=datetime.now,
57
56
  description='Timestamp when the exit started',
58
57
  )
59
- end_at: Optional[datetime] = Field(
58
+ end_at: datetime | None = Field(
60
59
  default=None,
61
60
  description='Timestamp when the exit ended',
62
61
  )
@@ -66,13 +65,11 @@ class AtsPossibleExit(BaseModel):
66
65
  default=False,
67
66
  description='Indicates if the exit has been recalculated',
68
67
  )
69
- is_blackbox: Optional[bool] = Field(
68
+ is_blackbox: bool | None = Field(
70
69
  default=False,
71
70
  description='Indicates if the exit is a blackbox',
72
71
  )
73
- false_positive_count: Optional[int] = Field(
72
+ false_positive_count: int | None = Field(
74
73
  default=0,
75
74
  description='Count of false positives detected',
76
75
  )
77
-
78
- model_config = ConfigDict(from_attributes=True) # enables .from_orm()
@@ -1,10 +1,11 @@
1
1
  """Ats Reception entity"""
2
2
 
3
3
  from datetime import datetime
4
- from typing import Optional
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
7
+ from layrz_sdk.constants import UTC
8
+
8
9
 
9
10
  class AtsReception(BaseModel):
10
11
  """AtsReception entity"""
@@ -14,12 +15,12 @@ class AtsReception(BaseModel):
14
15
  description='Volume bought in liters',
15
16
  default=0.0,
16
17
  )
17
- real_volume: Optional[float] = Field(
18
+ real_volume: float | None = Field(
18
19
  description='Real volume in liters',
19
20
  default=None,
20
21
  )
21
22
 
22
23
  received_at: datetime = Field(
23
24
  description='Date and time when the reception was made',
24
- default_factory=datetime.now,
25
+ default_factory=lambda: datetime.now(UTC),
25
26
  )
@@ -8,6 +8,6 @@ from pydantic import BaseModel, Field
8
8
  class BroadcastService(BaseModel):
9
9
  """Broadcast Service object"""
10
10
 
11
- pk: int = Field(..., description='Service ID')
11
+ pk: int = Field(..., description='Service ID', alias='id')
12
12
  name: str = Field(..., description='Service name')
13
13
  credentials: dict[str, Any] = Field(default_factory=dict, description='Service credentials')
@@ -1,15 +1,10 @@
1
1
  """Broadcast result Status"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class BroadcastStatus(str, Enum):
7
+ class BroadcastStatus(StrEnum):
13
8
  """Broadcast result status"""
14
9
 
15
10
  OK = 'OK'
@@ -1,8 +1,7 @@
1
1
  """Events entities"""
2
2
 
3
- import sys
4
3
  from datetime import datetime
5
- from typing import Any, Optional
4
+ from typing import Any, Optional, Self
6
5
 
7
6
  from pydantic import BaseModel, Field, model_validator
8
7
 
@@ -11,16 +10,11 @@ from .case_status import CaseStatus
11
10
  from .comment import Comment
12
11
  from .trigger import Trigger
13
12
 
14
- if sys.version_info >= (3, 11):
15
- from typing import Self
16
- else:
17
- from typing_extensions import Self
18
-
19
13
 
20
14
  class Case(BaseModel):
21
15
  """Case entity"""
22
16
 
23
- pk: int = Field(description='Defines the primary key of the case')
17
+ pk: int = Field(description='Defines the primary key of the case', alias='id')
24
18
  trigger: Trigger = Field(description='Defines the trigger of the case')
25
19
  asset_id: int = Field(description='Defines the asset ID of the case')
26
20
  comments: list[Comment] = Field(default_factory=list, description='Defines the comments of the case')
@@ -1,13 +1,8 @@
1
- import sys
2
- from enum import Enum
1
+ from enum import StrEnum
2
+ from typing import Self
3
3
 
4
- if sys.version_info >= (3, 11):
5
- from typing import Self
6
- else:
7
- from typing_extensions import Self
8
4
 
9
-
10
- class CaseIgnoredStatus(str, Enum):
5
+ class CaseIgnoredStatus(StrEnum):
11
6
  """
12
7
  Case ignore status, will define what kind ignore happened.
13
8
  """
@@ -1,13 +1,8 @@
1
- import sys
2
- from enum import Enum
1
+ from enum import StrEnum
2
+ from typing import Self
3
3
 
4
- if sys.version_info >= (3, 11):
5
- from typing import Self
6
- else:
7
- from typing_extensions import Self
8
4
 
9
-
10
- class CaseStatus(str, Enum):
5
+ class CaseStatus(StrEnum):
11
6
  """Case status enum"""
12
7
 
13
8
  PENDING = 'PENDING'
@@ -1,7 +1,6 @@
1
1
  """Bar chart"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
@@ -11,11 +10,6 @@ from .chart_data_serie import ChartDataSerie
11
10
  from .chart_data_serie_type import ChartDataSerieType
12
11
  from .chart_render_technology import ChartRenderTechnology
13
12
 
14
- if sys.version_info >= (3, 11):
15
- from typing import Self
16
- else:
17
- from typing_extensions import Self
18
-
19
13
 
20
14
  class BarChart(BaseModel):
21
15
  """Bar chart configuration"""
@@ -1,15 +1,10 @@
1
1
  """Chart alignment"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class ChartAlignment(str, Enum):
7
+ class ChartAlignment(StrEnum):
13
8
  """
14
9
  Chart Alignment
15
10
  """
@@ -1,15 +1,10 @@
1
1
  """Chart alignment"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class ChartColor(str, Enum):
7
+ class ChartColor(StrEnum):
13
8
  """Chart color list, ideal to use to colorize the series"""
14
9
 
15
10
  RED = '#F44336'
@@ -1,28 +1,23 @@
1
1
  """Chart Serie type"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class ChartDataSerieType(Enum):
7
+ class ChartDataSerieType(StrEnum):
13
8
  """
14
9
  Chart data serie type
15
10
  """
16
11
 
17
- NONE = None
12
+ NONE = 'None'
18
13
  LINE = 'line'
19
14
  AREA = 'area'
20
15
  SCATTER = 'scatter'
21
16
 
22
- def __str__(self) -> str:
17
+ def __str__(self: Self) -> str:
23
18
  """Readable property"""
24
19
  return self.name
25
20
 
26
- def __repr__(self) -> str:
21
+ def __repr__(self: Self) -> str:
27
22
  """Readable property"""
28
23
  return f'ChartDataSerieType.{self.name}'
@@ -1,15 +1,10 @@
1
1
  """Chart Data type"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class ChartDataType(str, Enum):
7
+ class ChartDataType(StrEnum):
13
8
  """
14
9
  Chart Data Type
15
10
  """
@@ -1,15 +1,10 @@
1
1
  """Chart rendering technology / library"""
2
2
 
3
- import sys
4
- from enum import Enum
3
+ from enum import StrEnum
4
+ from typing import Self
5
5
 
6
- if sys.version_info >= (3, 11):
7
- from typing import Self
8
- else:
9
- from typing_extensions import Self
10
6
 
11
-
12
- class ChartRenderTechnology(str, Enum):
7
+ class ChartRenderTechnology(StrEnum):
13
8
  """
14
9
  Chart Alignment
15
10
  """
@@ -1,7 +1,8 @@
1
1
  """Column chart"""
2
2
 
3
- import sys
4
- from typing import Any
3
+ from typing import Any, Self
4
+
5
+ from pydantic import BaseModel, Field
5
6
 
6
7
  from layrz_sdk.helpers import convert_to_rgba
7
8
 
@@ -11,12 +12,6 @@ from .chart_data_serie import ChartDataSerie
11
12
  from .chart_data_serie_type import ChartDataSerieType
12
13
  from .chart_render_technology import ChartRenderTechnology
13
14
 
14
- if sys.version_info >= (3, 11):
15
- from typing import Self
16
- else:
17
- from typing_extensions import Self
18
- from pydantic import BaseModel, Field
19
-
20
15
 
21
16
  class ColumnChart(BaseModel):
22
17
  """Column chart configuration"""
@@ -1,15 +1,9 @@
1
1
  """HTML chart"""
2
2
 
3
- import sys
4
- from typing import Any, Dict
3
+ from typing import Any, Dict, Self
5
4
 
6
5
  from pydantic import BaseModel, Field
7
6
 
8
- if sys.version_info >= (3, 11):
9
- from typing import Self
10
- else:
11
- from typing_extensions import Self
12
-
13
7
 
14
8
  class HTMLChart(BaseModel):
15
9
  """HTML chart configuration"""
@@ -1,8 +1,7 @@
1
1
  """Line chart"""
2
2
 
3
3
  import logging
4
- import sys
5
- from typing import Any
4
+ from typing import Any, Self
6
5
 
7
6
  from pydantic import BaseModel, Field
8
7
 
@@ -13,11 +12,6 @@ from .chart_data_serie_type import ChartDataSerieType
13
12
  from .chart_data_type import ChartDataType
14
13
  from .chart_render_technology import ChartRenderTechnology
15
14
 
16
- if sys.version_info >= (3, 11):
17
- from typing import Self
18
- else:
19
- from typing_extensions import Self
20
-
21
15
  log = logging.getLogger(__name__)
22
16
 
23
17
 
@@ -1,13 +1,8 @@
1
- import sys
2
- from enum import Enum
1
+ from enum import StrEnum
2
+ from typing import Self
3
3
 
4
- if sys.version_info >= (3, 11):
5
- from typing import Self
6
- else:
7
- from typing_extensions import Self
8
4
 
9
-
10
- class MapCenterType(str, Enum):
5
+ class MapCenterType(StrEnum):
11
6
  """Map Chart center type"""
12
7
 
13
8
  FIXED = 'FIXED'