layrz-sdk 3.1.6__py3-none-any.whl → 3.1.8__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/asset.py +0 -10
- layrz_sdk/entities/report.py +13 -5
- {layrz_sdk-3.1.6.dist-info → layrz_sdk-3.1.8.dist-info}/METADATA +3 -2
- {layrz_sdk-3.1.6.dist-info → layrz_sdk-3.1.8.dist-info}/RECORD +7 -7
- {layrz_sdk-3.1.6.dist-info → layrz_sdk-3.1.8.dist-info}/WHEEL +1 -1
- {layrz_sdk-3.1.6.dist-info → layrz_sdk-3.1.8.dist-info/licenses}/LICENSE +0 -0
- {layrz_sdk-3.1.6.dist-info → layrz_sdk-3.1.8.dist-info}/top_level.txt +0 -0
layrz_sdk/entities/asset.py
CHANGED
|
@@ -42,16 +42,6 @@ class Asset(BaseModel):
|
|
|
42
42
|
if operation_mode == AssetOperationMode.ASSETMULTIPLE.name:
|
|
43
43
|
data['devices'] = []
|
|
44
44
|
|
|
45
|
-
elif operation_mode == AssetOperationMode.SINGLE.name:
|
|
46
|
-
primary: Optional[Device] = None
|
|
47
|
-
for device in data.get('devices', []):
|
|
48
|
-
if device['is_primary']:
|
|
49
|
-
primary = device
|
|
50
|
-
break
|
|
51
|
-
|
|
52
|
-
if primary is not None:
|
|
53
|
-
data['devices'] = [primary]
|
|
54
|
-
|
|
55
45
|
else:
|
|
56
46
|
data['children'] = []
|
|
57
47
|
|
layrz_sdk/entities/report.py
CHANGED
|
@@ -4,6 +4,7 @@ import logging
|
|
|
4
4
|
import os
|
|
5
5
|
import time
|
|
6
6
|
import warnings
|
|
7
|
+
from pathlib import Path
|
|
7
8
|
from typing import Any, Dict, List, Optional
|
|
8
9
|
|
|
9
10
|
import xlsxwriter
|
|
@@ -51,7 +52,7 @@ class Report(BaseModel):
|
|
|
51
52
|
export_format: Optional[ReportFormat] = None,
|
|
52
53
|
password: Optional[str] = None,
|
|
53
54
|
msoffice_crypt_path: str = '/opt/msoffice/bin/msoffice-crypt.exe',
|
|
54
|
-
) ->
|
|
55
|
+
) -> Path | Dict[str, Any]:
|
|
55
56
|
"""
|
|
56
57
|
Export report to file
|
|
57
58
|
|
|
@@ -60,7 +61,7 @@ class Report(BaseModel):
|
|
|
60
61
|
:param password: Password to protect the file (Only works with Microsoft Excel format)
|
|
61
62
|
:param msoffice_crypt_path: Path to the msoffice-crypt.exe executable, used to encrypt the file
|
|
62
63
|
:return: Full path of the exported file or JSON representation of the report
|
|
63
|
-
:rtype:
|
|
64
|
+
:rtype: Path | dict
|
|
64
65
|
:raises AttributeError: If the export format is not supported
|
|
65
66
|
"""
|
|
66
67
|
if export_format:
|
|
@@ -135,10 +136,10 @@ class Report(BaseModel):
|
|
|
135
136
|
|
|
136
137
|
def _export_xlsx(
|
|
137
138
|
self,
|
|
138
|
-
path: str,
|
|
139
|
+
path: str | Path,
|
|
139
140
|
password: Optional[str] = None,
|
|
140
141
|
msoffice_crypt_path: Optional[str] = None,
|
|
141
|
-
) ->
|
|
142
|
+
) -> Path:
|
|
142
143
|
"""
|
|
143
144
|
Export to Microsoft Excel (.xslx)
|
|
144
145
|
:param path: Path to save the report
|
|
@@ -147,7 +148,14 @@ class Report(BaseModel):
|
|
|
147
148
|
:return: Full path of the exported file
|
|
148
149
|
"""
|
|
149
150
|
|
|
150
|
-
|
|
151
|
+
if isinstance(path, str):
|
|
152
|
+
path = Path(path).resolve()
|
|
153
|
+
|
|
154
|
+
full_path = path / self.filename
|
|
155
|
+
if full_path.exists():
|
|
156
|
+
log.warning(f'File {full_path} already exists, overwriting it')
|
|
157
|
+
os.remove(full_path)
|
|
158
|
+
|
|
151
159
|
book = xlsxwriter.Workbook(full_path)
|
|
152
160
|
|
|
153
161
|
pages_name: List[str] = []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: layrz-sdk
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.8
|
|
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>
|
|
@@ -21,6 +21,7 @@ Requires-Dist: xlsxwriter
|
|
|
21
21
|
Requires-Dist: tzdata
|
|
22
22
|
Requires-Dist: pydantic>=2.10.6
|
|
23
23
|
Requires-Dist: typing-extensions>=4.10.0
|
|
24
|
+
Dynamic: license-file
|
|
24
25
|
|
|
25
26
|
# Layrz SDK
|
|
26
27
|
|
|
@@ -2,7 +2,7 @@ layrz_sdk/__init__.py,sha256=ZB_ul85oms9MDwqHyl0X7QP3ry4tA9RdIe_o-aA3KB4,29
|
|
|
2
2
|
layrz_sdk/constants.py,sha256=mtwaA1oOBo8KZ8F4QVQoSN4_vjjWz1qE_y7HfPQeDBA,75
|
|
3
3
|
layrz_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
layrz_sdk/entities/__init__.py,sha256=Z_FnKRGVYH9pnrUcCJJBaYmoVOA67hQ-5iyDf7Ryva4,3823
|
|
5
|
-
layrz_sdk/entities/asset.py,sha256=
|
|
5
|
+
layrz_sdk/entities/asset.py,sha256=PsuGFSnpTf10vwk6cxcA1OOSstANZNKFQJeHFySPq-g,2209
|
|
6
6
|
layrz_sdk/entities/asset_operation_mode.py,sha256=FANfXq5k_4Nk3dvDZwlMrgl3XozmQyOttXRiQvoaFps,665
|
|
7
7
|
layrz_sdk/entities/broadcast_request.py,sha256=tuC8xDwYrHNzvM-rfEK-wQAPSJaTMirXENCp9fTUoOA,270
|
|
8
8
|
layrz_sdk/entities/broadcast_response.py,sha256=qMu2qZ0jWubN9R3lwi_MKnsSnCKWav7lP6JfWBuHh8s,273
|
|
@@ -23,7 +23,7 @@ layrz_sdk/entities/message.py,sha256=WS36Zm0FwvbzCZ7Tywtqvgb_hPy_Rtg4WZ1sskeQEx4
|
|
|
23
23
|
layrz_sdk/entities/outbound_service.py,sha256=h1B23WFfBAiUZxf-SdlgJn2yib_qxCRc8a1KlGq7d1I,235
|
|
24
24
|
layrz_sdk/entities/position.py,sha256=j2WLAUcYVIVSGv_u8_dyLNFL4XXKQ96pXwzpvWjDaIo,2825
|
|
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=vl9aWry6M5fKAVkooKqcSKnbXujLNx8c8quNK3e1PBY,8702
|
|
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=uWW-TbDdmAJ8w8Pjr7B3xjEJi6BzCsqzThj2974H3nM
|
|
|
68
68
|
layrz_sdk/helpers/color.py,sha256=McSoqsWKQ6suW14LMzwkdvruutm5xyvpE057IlBWm0Y,1248
|
|
69
69
|
layrz_sdk/lcl/__init__.py,sha256=T9yk0RccanRnnITbw5tTxWld1gZFG6ySjvZ9G16mxPU,101
|
|
70
70
|
layrz_sdk/lcl/core.py,sha256=R740h8EYKQwIUJ2TPwTrmctbl_LkCb8z4lP3fmruiNA,25161
|
|
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.8.dist-info/licenses/LICENSE,sha256=h4aQZdgkHkEP6_m5wPfTsdDRdWOOgP7G_10OgDNmBf4,1063
|
|
72
|
+
layrz_sdk-3.1.8.dist-info/METADATA,sha256=YcZqac6eaees6lix-qzWLJYq6K2H8fkHRDh_Ka_syAM,1900
|
|
73
|
+
layrz_sdk-3.1.8.dist-info/WHEEL,sha256=tTnHoFhvKQHCh4jz3yCn0WPTYIy7wXx3CJtJ7SJGV7c,91
|
|
74
|
+
layrz_sdk-3.1.8.dist-info/top_level.txt,sha256=yUTMMzfdZ0HDWQH5TaSlFM4xtwmP1fSGxmlL1dmu4l4,10
|
|
75
|
+
layrz_sdk-3.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|