layrz-sdk 3.1.12__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/entities/case.py +5 -1
- layrz_sdk/entities/custom_report_page.py +27 -3
- layrz_sdk/entities/report.py +7 -1
- {layrz_sdk-3.1.12.dist-info → layrz_sdk-3.1.14.dist-info}/METADATA +1 -1
- {layrz_sdk-3.1.12.dist-info → layrz_sdk-3.1.14.dist-info}/RECORD +8 -8
- {layrz_sdk-3.1.12.dist-info → layrz_sdk-3.1.14.dist-info}/WHEEL +1 -1
- {layrz_sdk-3.1.12.dist-info → layrz_sdk-3.1.14.dist-info}/licenses/LICENSE +0 -0
- {layrz_sdk-3.1.12.dist-info → layrz_sdk-3.1.14.dist-info}/top_level.txt +0 -0
layrz_sdk/entities/case.py
CHANGED
|
@@ -41,7 +41,11 @@ class Case(BaseModel):
|
|
|
41
41
|
"""Validate model"""
|
|
42
42
|
sequence = data.get('sequence')
|
|
43
43
|
if sequence is not None and isinstance(sequence, int):
|
|
44
|
-
|
|
44
|
+
trigger = data['trigger']
|
|
45
|
+
if not isinstance(trigger, Trigger):
|
|
46
|
+
data['sequence'] = f'{trigger["code"]}/{data["pk"]}'
|
|
47
|
+
else:
|
|
48
|
+
data['sequence'] = f'{trigger.code}/{sequence}'
|
|
45
49
|
else:
|
|
46
50
|
data['sequence'] = f'GENERIC/{data["pk"]}'
|
|
47
51
|
|
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
|
+
from typing import Any, Protocol, runtime_checkable
|
|
2
3
|
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
4
5
|
from xlsxwriter.worksheet import Worksheet
|
|
5
6
|
|
|
6
7
|
|
|
8
|
+
@runtime_checkable
|
|
9
|
+
class BuilderFunction(Protocol):
|
|
10
|
+
"""
|
|
11
|
+
Protocol for the builder function.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __call__(self, *, sheet: Worksheet, **kwargs: Any) -> None: ...
|
|
15
|
+
|
|
16
|
+
|
|
7
17
|
class CustomReportPage(BaseModel):
|
|
8
18
|
"""
|
|
9
19
|
Custom report page
|
|
10
20
|
Basically it's a wrapper of the `xlswriter` worksheet that uses a function to construct the page
|
|
11
21
|
"""
|
|
12
22
|
|
|
23
|
+
model_config = ConfigDict(
|
|
24
|
+
from_attributes=True,
|
|
25
|
+
arbitrary_types_allowed=True,
|
|
26
|
+
)
|
|
27
|
+
|
|
13
28
|
name: str = Field(description='Name of the page. Length should be less than 60 characters')
|
|
14
|
-
builder: Callable[[Worksheet], None] = Field(
|
|
15
|
-
description='Function to build the page. The only argument is the worksheet object',
|
|
29
|
+
builder: Callable[[Worksheet], None] | None = Field(
|
|
30
|
+
description=('Function to build the page. The only argument is the worksheet object'),
|
|
31
|
+
default=None,
|
|
32
|
+
)
|
|
33
|
+
extended_builder: BuilderFunction | None = Field(
|
|
34
|
+
description=(
|
|
35
|
+
'Function to build the page. The first argument is the worksheet object, '
|
|
36
|
+
'and the rest are the kwargs to give support for the builder function.'
|
|
37
|
+
'\n Currently, the only supported kwarg is `workbook` which is the workbook object'
|
|
38
|
+
),
|
|
39
|
+
default=None,
|
|
16
40
|
)
|
layrz_sdk/entities/report.py
CHANGED
|
@@ -190,7 +190,13 @@ class Report(BaseModel):
|
|
|
190
190
|
sheet = book.add_worksheet(sheet_name)
|
|
191
191
|
|
|
192
192
|
if isinstance(page, CustomReportPage):
|
|
193
|
-
page.
|
|
193
|
+
if page.extended_builder:
|
|
194
|
+
page.extended_builder(sheet=sheet, workbook=book)
|
|
195
|
+
elif page.builder:
|
|
196
|
+
page.builder(sheet)
|
|
197
|
+
else:
|
|
198
|
+
raise AttributeError('Custom report page must have a builder or extended_builder function')
|
|
199
|
+
|
|
194
200
|
sheet.autofit()
|
|
195
201
|
continue
|
|
196
202
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: layrz-sdk
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.14
|
|
4
4
|
Summary: Layrz SDK for Python
|
|
5
5
|
Author-email: "Golden M, Inc." <software@goldenm.com>
|
|
6
6
|
Maintainer-email: Kenny Mochizuki <kenny@goldenm.com>, Luis Reyes <lreyes@goldenm.com>, Kasen Li <kli@goldenm.com>
|
|
@@ -8,13 +8,13 @@ layrz_sdk/entities/broadcast_request.py,sha256=65j4X1rhWEikftX3fiNl8YWRHu7nNs5bd
|
|
|
8
8
|
layrz_sdk/entities/broadcast_response.py,sha256=iV2R2JGIGHxJRSAiEwnw4SGOMPXby8P5Yp2eQF6ia6s,275
|
|
9
9
|
layrz_sdk/entities/broadcast_result.py,sha256=KlUjb5beH9-SDw6KygWE6TGYS5QQGaLUH25BaCWcowY,706
|
|
10
10
|
layrz_sdk/entities/broadcast_status.py,sha256=N_sszSFPIG3PKER9QYYI66E15xpnOm1QRMlqfrF7r08,620
|
|
11
|
-
layrz_sdk/entities/case.py,sha256=
|
|
11
|
+
layrz_sdk/entities/case.py,sha256=m5CGauy5zeWpn-eknNenFJXuCQGMp3Qyqas7gnqt_Hg,1929
|
|
12
12
|
layrz_sdk/entities/case_ignored_status.py,sha256=n2_bPXd2Jfo9UHald0JoBj4AqfKX0ZWM-ZxlXbfiiG0,538
|
|
13
13
|
layrz_sdk/entities/case_status.py,sha256=RjACxI9agdcowiywcTLweA6yAgP0y4HvvY5PFKW79yk,461
|
|
14
14
|
layrz_sdk/entities/checkpoint.py,sha256=zwhEI2XpZPZ1mETZfTc2jBfbrB0L-Z5Ze8nmy2WerqM,530
|
|
15
15
|
layrz_sdk/entities/comment.py,sha256=DAh6mlchqOMBeV1OhOEausEuyms4epv0ukODxFo7rPA,430
|
|
16
16
|
layrz_sdk/entities/custom_field.py,sha256=HETHOohTx1Cp98dF11Huox6L_UVuBzz2F5nZhwuUCsk,287
|
|
17
|
-
layrz_sdk/entities/custom_report_page.py,sha256=
|
|
17
|
+
layrz_sdk/entities/custom_report_page.py,sha256=iPkBON7KLb7xU1qEqBBxqdoGKeZhz7BRJ5wyWejSkJ0,1271
|
|
18
18
|
layrz_sdk/entities/device.py,sha256=mdrRFVZpr1HnGIJSLn-S0I_bwxbEnqPRJXivupqMG44,508
|
|
19
19
|
layrz_sdk/entities/event.py,sha256=KWTLStPO2q8TyHa_HUIzWYeFPBYZgT0SNpuru1fh14k,777
|
|
20
20
|
layrz_sdk/entities/geofence.py,sha256=g87P_HtVVACdwsE-o8potFo9snIRjc_3r6ePvsRw_ac,337
|
|
@@ -23,7 +23,7 @@ layrz_sdk/entities/message.py,sha256=9jl4ytijrrU5g8O03Eum1rzUpjPLOtLcwgucBPZ1aWU
|
|
|
23
23
|
layrz_sdk/entities/outbound_service.py,sha256=h1B23WFfBAiUZxf-SdlgJn2yib_qxCRc8a1KlGq7d1I,235
|
|
24
24
|
layrz_sdk/entities/position.py,sha256=pINPKYfnrDUzzkmZBGotYyFPhPn6jgh5qje-QDNTC0A,3156
|
|
25
25
|
layrz_sdk/entities/presence_type.py,sha256=aR14DlVNxtm9ZC4DjCD2QBELY3Zu1JdWHrDLW3dYEiI,309
|
|
26
|
-
layrz_sdk/entities/report.py,sha256=
|
|
26
|
+
layrz_sdk/entities/report.py,sha256=yavbKKTBf2njZ5E2zUXrVMiI2bycXhPRS5fGB5OR7YA,9410
|
|
27
27
|
layrz_sdk/entities/report_col.py,sha256=iyRG81UDw-xXqGUN-nFaA1CPz4bUllAzxDki92cwN1s,1401
|
|
28
28
|
layrz_sdk/entities/report_configuration.py,sha256=pG_P-_LG78MJ0FxINwWze2Oo4YVylKSSshZcLyF4xDI,244
|
|
29
29
|
layrz_sdk/entities/report_data_type.py,sha256=-ck2hBmDcgWJpT9z_cUxbEOy-Yq0OaYfzjSSz5uj2w0,525
|
|
@@ -68,8 +68,8 @@ layrz_sdk/helpers/__init__.py,sha256=a5rlbJXtN46UI3w-xI1k7bziqDsF8NTVJV-HlViOP1o
|
|
|
68
68
|
layrz_sdk/helpers/color.py,sha256=r8HEQSE8yarB1MUdXdY3Yh91QjpxgIN0y-Lnn9wT5qg,1247
|
|
69
69
|
layrz_sdk/lcl/__init__.py,sha256=ZuSgEWVb-i3Ltb_M_SNfel-hqG42dGjMc0vLxFEW97I,94
|
|
70
70
|
layrz_sdk/lcl/core.py,sha256=_gEfJIW3qiFeq_lpF42qS6c2LH2e6Z0WE1ExmqZgtP0,25634
|
|
71
|
-
layrz_sdk-3.1.
|
|
72
|
-
layrz_sdk-3.1.
|
|
73
|
-
layrz_sdk-3.1.
|
|
74
|
-
layrz_sdk-3.1.
|
|
75
|
-
layrz_sdk-3.1.
|
|
71
|
+
layrz_sdk-3.1.14.dist-info/licenses/LICENSE,sha256=h4aQZdgkHkEP6_m5wPfTsdDRdWOOgP7G_10OgDNmBf4,1063
|
|
72
|
+
layrz_sdk-3.1.14.dist-info/METADATA,sha256=AGvrxFUarA07umXfwTa81hL4VpLY2iIHWi-uegzVhuk,1901
|
|
73
|
+
layrz_sdk-3.1.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
74
|
+
layrz_sdk-3.1.14.dist-info/top_level.txt,sha256=yUTMMzfdZ0HDWQH5TaSlFM4xtwmP1fSGxmlL1dmu4l4,10
|
|
75
|
+
layrz_sdk-3.1.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|