layrz-sdk 3.1.13__py3-none-any.whl → 3.1.14__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.
- layrz_sdk/__init__.py +1 -1
- layrz_sdk/constants.py +5 -5
- layrz_sdk/entities/__init__.py +129 -129
- layrz_sdk/entities/asset.py +60 -60
- layrz_sdk/entities/asset_operation_mode.py +31 -31
- layrz_sdk/entities/broadcast_request.py +12 -12
- layrz_sdk/entities/broadcast_response.py +12 -12
- layrz_sdk/entities/broadcast_result.py +20 -20
- layrz_sdk/entities/broadcast_status.py +28 -28
- layrz_sdk/entities/case.py +52 -48
- layrz_sdk/entities/case_ignored_status.py +26 -26
- layrz_sdk/entities/case_status.py +23 -23
- layrz_sdk/entities/charts/axis_config.py +15 -15
- layrz_sdk/entities/charts/bar_chart.py +175 -175
- layrz_sdk/entities/charts/chart_alignment.py +27 -27
- layrz_sdk/entities/charts/chart_color.py +44 -44
- layrz_sdk/entities/charts/chart_configuration.py +10 -10
- layrz_sdk/entities/charts/chart_data_serie.py +19 -19
- layrz_sdk/entities/charts/chart_data_serie_type.py +28 -28
- layrz_sdk/entities/charts/chart_data_type.py +27 -27
- layrz_sdk/entities/charts/chart_render_technology.py +30 -30
- layrz_sdk/entities/charts/column_chart.py +201 -201
- layrz_sdk/entities/charts/html_chart.py +38 -38
- layrz_sdk/entities/charts/line_chart.py +248 -248
- layrz_sdk/entities/charts/map_center_type.py +22 -22
- layrz_sdk/entities/charts/map_chart.py +108 -108
- layrz_sdk/entities/charts/map_point.py +22 -22
- layrz_sdk/entities/charts/number_chart.py +54 -54
- layrz_sdk/entities/charts/pie_chart.py +131 -131
- layrz_sdk/entities/charts/radar_chart.py +81 -81
- layrz_sdk/entities/charts/radial_bar_chart.py +131 -131
- layrz_sdk/entities/charts/scatter_chart.py +210 -210
- layrz_sdk/entities/charts/scatter_serie.py +13 -13
- layrz_sdk/entities/charts/scatter_serie_item.py +8 -8
- layrz_sdk/entities/charts/table_chart.py +54 -54
- layrz_sdk/entities/charts/table_header.py +8 -8
- layrz_sdk/entities/charts/table_row.py +9 -9
- layrz_sdk/entities/charts/timeline_chart.py +79 -79
- layrz_sdk/entities/charts/timeline_serie.py +10 -10
- layrz_sdk/entities/charts/timeline_serie_item.py +12 -12
- layrz_sdk/entities/checkpoint.py +17 -17
- layrz_sdk/entities/comment.py +16 -16
- layrz_sdk/entities/custom_field.py +10 -10
- layrz_sdk/entities/custom_report_page.py +40 -40
- layrz_sdk/entities/device.py +13 -13
- layrz_sdk/entities/event.py +23 -23
- layrz_sdk/entities/geofence.py +11 -11
- layrz_sdk/entities/last_message.py +12 -12
- layrz_sdk/entities/message.py +23 -23
- layrz_sdk/entities/outbound_service.py +10 -10
- layrz_sdk/entities/position.py +116 -116
- layrz_sdk/entities/presence_type.py +16 -16
- layrz_sdk/entities/report.py +289 -289
- layrz_sdk/entities/report_col.py +40 -40
- layrz_sdk/entities/report_configuration.py +8 -8
- layrz_sdk/entities/report_data_type.py +28 -28
- layrz_sdk/entities/report_format.py +27 -27
- layrz_sdk/entities/report_header.py +43 -43
- layrz_sdk/entities/report_page.py +15 -15
- layrz_sdk/entities/report_row.py +28 -28
- layrz_sdk/entities/sensor.py +11 -11
- layrz_sdk/entities/text_alignment.py +26 -26
- layrz_sdk/entities/trigger.py +11 -11
- layrz_sdk/entities/user.py +10 -10
- layrz_sdk/entities/waypoint.py +18 -18
- layrz_sdk/helpers/__init__.py +5 -5
- layrz_sdk/helpers/color.py +44 -44
- layrz_sdk/lcl/__init__.py +5 -5
- layrz_sdk/lcl/core.py +848 -848
- {layrz_sdk-3.1.13.dist-info → layrz_sdk-3.1.14.dist-info}/METADATA +49 -49
- layrz_sdk-3.1.14.dist-info/RECORD +75 -0
- {layrz_sdk-3.1.13.dist-info → layrz_sdk-3.1.14.dist-info}/WHEEL +1 -1
- {layrz_sdk-3.1.13.dist-info → layrz_sdk-3.1.14.dist-info}/licenses/LICENSE +6 -6
- layrz_sdk-3.1.13.dist-info/RECORD +0 -75
- {layrz_sdk-3.1.13.dist-info → layrz_sdk-3.1.14.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class ReportConfiguration(BaseModel):
|
|
5
|
-
"""Report configuration entity"""
|
|
6
|
-
|
|
7
|
-
title: str = Field(description='Report title')
|
|
8
|
-
pages_count: int = Field(description='Number of pages in the report')
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ReportConfiguration(BaseModel):
|
|
5
|
+
"""Report configuration entity"""
|
|
6
|
+
|
|
7
|
+
title: str = Field(description='Report title')
|
|
8
|
+
pages_count: int = Field(description='Number of pages in the report')
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from enum import Enum
|
|
3
|
-
|
|
4
|
-
if sys.version_info >= (3, 11):
|
|
5
|
-
from typing import Self
|
|
6
|
-
else:
|
|
7
|
-
from typing_extensions import Self
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class ReportDataType(Enum):
|
|
11
|
-
"""
|
|
12
|
-
Report date type
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
STR = 'str'
|
|
16
|
-
INT = 'int'
|
|
17
|
-
FLOAT = 'float'
|
|
18
|
-
DATETIME = 'datetime'
|
|
19
|
-
BOOL = 'bool'
|
|
20
|
-
CURRENCY = 'currency'
|
|
21
|
-
|
|
22
|
-
def __str__(self: Self) -> str:
|
|
23
|
-
"""Readable property"""
|
|
24
|
-
return self.name
|
|
25
|
-
|
|
26
|
-
def __repr__(self: Self) -> str:
|
|
27
|
-
"""Readable property"""
|
|
28
|
-
return f'ReportDataType.{self.value}'
|
|
1
|
+
import sys
|
|
2
|
+
from enum import Enum
|
|
3
|
+
|
|
4
|
+
if sys.version_info >= (3, 11):
|
|
5
|
+
from typing import Self
|
|
6
|
+
else:
|
|
7
|
+
from typing_extensions import Self
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ReportDataType(Enum):
|
|
11
|
+
"""
|
|
12
|
+
Report date type
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
STR = 'str'
|
|
16
|
+
INT = 'int'
|
|
17
|
+
FLOAT = 'float'
|
|
18
|
+
DATETIME = 'datetime'
|
|
19
|
+
BOOL = 'bool'
|
|
20
|
+
CURRENCY = 'currency'
|
|
21
|
+
|
|
22
|
+
def __str__(self: Self) -> str:
|
|
23
|
+
"""Readable property"""
|
|
24
|
+
return self.name
|
|
25
|
+
|
|
26
|
+
def __repr__(self: Self) -> str:
|
|
27
|
+
"""Readable property"""
|
|
28
|
+
return f'ReportDataType.{self.value}'
|
|
@@ -1,27 +1,27 @@
|
|
|
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}'
|
|
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}'
|
|
@@ -1,43 +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[float] = 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
|
|
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[float] = 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
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"""Report page"""
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
-
|
|
5
|
-
from .report_header import ReportHeader
|
|
6
|
-
from .report_row import ReportRow
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ReportPage(BaseModel):
|
|
10
|
-
"""Report page definition"""
|
|
11
|
-
|
|
12
|
-
name: str = Field(description='Name of the page. Length should be less than 60 characters')
|
|
13
|
-
headers: list[ReportHeader] = Field(description='List of report headers', default_factory=list)
|
|
14
|
-
rows: list[ReportRow] = Field(description='List of report rows', default_factory=list)
|
|
15
|
-
freeze_header: bool = Field(description='Freeze header', default=False)
|
|
1
|
+
"""Report page"""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
from .report_header import ReportHeader
|
|
6
|
+
from .report_row import ReportRow
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ReportPage(BaseModel):
|
|
10
|
+
"""Report page definition"""
|
|
11
|
+
|
|
12
|
+
name: str = Field(description='Name of the page. Length should be less than 60 characters')
|
|
13
|
+
headers: list[ReportHeader] = Field(description='List of report headers', default_factory=list)
|
|
14
|
+
rows: list[ReportRow] = Field(description='List of report rows', default_factory=list)
|
|
15
|
+
freeze_header: bool = Field(description='Freeze header', default=False)
|
layrz_sdk/entities/report_row.py
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"""Report row"""
|
|
2
|
-
|
|
3
|
-
import warnings
|
|
4
|
-
from typing import Any, 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
|
|
1
|
+
"""Report row"""
|
|
2
|
+
|
|
3
|
+
import warnings
|
|
4
|
+
from typing import Any, 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
|
layrz_sdk/entities/sensor.py
CHANGED
|
@@ -1,11 +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
|
+
"""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,26 +1,26 @@
|
|
|
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}'
|
|
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}'
|
layrz_sdk/entities/trigger.py
CHANGED
|
@@ -1,11 +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')
|
|
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')
|
layrz_sdk/entities/user.py
CHANGED
|
@@ -1,10 +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')
|
|
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')
|
layrz_sdk/entities/waypoint.py
CHANGED
|
@@ -1,18 +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
|
+
"""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')
|
layrz_sdk/helpers/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"""Layrz SDK Helpers"""
|
|
2
|
-
|
|
3
|
-
from .color import convert_to_rgba, use_black
|
|
4
|
-
|
|
5
|
-
__all__ = ['convert_to_rgba', 'use_black']
|
|
1
|
+
"""Layrz SDK Helpers"""
|
|
2
|
+
|
|
3
|
+
from .color import convert_to_rgba, use_black
|
|
4
|
+
|
|
5
|
+
__all__ = ['convert_to_rgba', 'use_black']
|
layrz_sdk/helpers/color.py
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"""Color helpers"""
|
|
2
|
-
|
|
3
|
-
from typing import 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
|
-
|
|
12
|
-
:param hex_color: Hex color
|
|
13
|
-
:type hex_color: str
|
|
14
|
-
|
|
15
|
-
:return: RGB or RGBA color
|
|
16
|
-
:rtype: tuple
|
|
17
|
-
|
|
18
|
-
:raises ValueError: If the color is invalid
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
if not hex_color.startswith('#'):
|
|
22
|
-
raise ValueError('Invalid color, must starts with #')
|
|
23
|
-
|
|
24
|
-
hex_color = hex_color.replace('#', '')
|
|
25
|
-
if len(hex_color) == 6:
|
|
26
|
-
return cast(Color, tuple(int(hex_color[i : i + 2], 16) for i in (0, 2, 4)) + (1,))
|
|
27
|
-
|
|
28
|
-
return cast(Color, tuple(int(hex_color[i : i + 2], 16) for i in (0, 2, 4, 6)))
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def use_black(color: str) -> bool:
|
|
32
|
-
"""
|
|
33
|
-
Use black
|
|
34
|
-
Will return when the background color works well with black text color.
|
|
35
|
-
Note: This method is not 100% accurate and will not work with alpha channel (Hexa color)
|
|
36
|
-
:param color: Hex color
|
|
37
|
-
:type color: str
|
|
38
|
-
:return: True if the color works well with black text color
|
|
39
|
-
:rtype: bool
|
|
40
|
-
:raises ValueError: If the color is invalid
|
|
41
|
-
"""
|
|
42
|
-
rgb = convert_to_rgba(color)
|
|
43
|
-
a = 1 - (0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]) / 255
|
|
44
|
-
return a < 0.5
|
|
1
|
+
"""Color helpers"""
|
|
2
|
+
|
|
3
|
+
from typing import 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
|
+
|
|
12
|
+
:param hex_color: Hex color
|
|
13
|
+
:type hex_color: str
|
|
14
|
+
|
|
15
|
+
:return: RGB or RGBA color
|
|
16
|
+
:rtype: tuple
|
|
17
|
+
|
|
18
|
+
:raises ValueError: If the color is invalid
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
if not hex_color.startswith('#'):
|
|
22
|
+
raise ValueError('Invalid color, must starts with #')
|
|
23
|
+
|
|
24
|
+
hex_color = hex_color.replace('#', '')
|
|
25
|
+
if len(hex_color) == 6:
|
|
26
|
+
return cast(Color, tuple(int(hex_color[i : i + 2], 16) for i in (0, 2, 4)) + (1,))
|
|
27
|
+
|
|
28
|
+
return cast(Color, tuple(int(hex_color[i : i + 2], 16) for i in (0, 2, 4, 6)))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def use_black(color: str) -> bool:
|
|
32
|
+
"""
|
|
33
|
+
Use black
|
|
34
|
+
Will return when the background color works well with black text color.
|
|
35
|
+
Note: This method is not 100% accurate and will not work with alpha channel (Hexa color)
|
|
36
|
+
:param color: Hex color
|
|
37
|
+
:type color: str
|
|
38
|
+
:return: True if the color works well with black text color
|
|
39
|
+
:rtype: bool
|
|
40
|
+
:raises ValueError: If the color is invalid
|
|
41
|
+
"""
|
|
42
|
+
rgb = convert_to_rgba(color)
|
|
43
|
+
a = 1 - (0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]) / 255
|
|
44
|
+
return a < 0.5
|
layrz_sdk/lcl/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"""Layrz Compute Language (LCL) SDK"""
|
|
2
|
-
|
|
3
|
-
from .core import LclCore
|
|
4
|
-
|
|
5
|
-
__all__ = ['LclCore']
|
|
1
|
+
"""Layrz Compute Language (LCL) SDK"""
|
|
2
|
+
|
|
3
|
+
from .core import LclCore
|
|
4
|
+
|
|
5
|
+
__all__ = ['LclCore']
|