1 | import base64 |
||
2 | from core.utilities import get_translation |
||
3 | import os |
||
4 | import re |
||
5 | import uuid |
||
6 | import openpyxl.utils.cell as format_cell |
||
7 | from openpyxl import Workbook |
||
8 | from openpyxl.chart import LineChart, Reference |
||
9 | from openpyxl.drawing.image import Image |
||
10 | from openpyxl.styles import PatternFill, Border, Side, Alignment, Font |
||
11 | from core.utilities import round2 |
||
12 | |||
13 | |||
14 | ######################################################################################################################## |
||
15 | # PROCEDURES |
||
16 | # Step 1: Validate the report data |
||
17 | # Step 2: Generate excelexporters file |
||
18 | # Step 3: Encode the excelexporters file to Base64 |
||
19 | ######################################################################################################################## |
||
20 | View Code Duplication | def export(result, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
|
0 ignored issues
–
show
Duplication
introduced
by
![]() |
|||
21 | #################################################################################################################### |
||
22 | # Step 1: Validate the report data |
||
23 | #################################################################################################################### |
||
24 | if result is None: |
||
25 | return None |
||
26 | |||
27 | #################################################################################################################### |
||
28 | # Step 2: Generate excel file from the report data |
||
29 | #################################################################################################################### |
||
30 | filename = generate_excel(result, |
||
31 | name, |
||
32 | reporting_start_datetime_local, |
||
33 | reporting_end_datetime_local, |
||
34 | period_type, |
||
35 | language) |
||
36 | #################################################################################################################### |
||
37 | # Step 3: Encode the excel file to Base64 |
||
38 | #################################################################################################################### |
||
39 | binary_file_data = b'' |
||
40 | try: |
||
41 | with open(filename, 'rb') as binary_file: |
||
42 | binary_file_data = binary_file.read() |
||
43 | except IOError as ex: |
||
44 | print(str(ex)) |
||
45 | |||
46 | # Base64 encode the bytes |
||
47 | base64_encoded_data = base64.b64encode(binary_file_data) |
||
48 | # get the Base64 encoded data using human-readable characters. |
||
49 | base64_message = base64_encoded_data.decode('utf-8') |
||
50 | # delete the file from server |
||
51 | try: |
||
52 | os.remove(filename) |
||
53 | except NotImplementedError as ex: |
||
54 | print(str(ex)) |
||
55 | return base64_message |
||
56 | |||
57 | |||
58 | def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
||
59 | |||
60 | trans = get_translation(language) |
||
61 | trans.install() |
||
62 | _ = trans.gettext |
||
63 | |||
64 | wb = Workbook() |
||
65 | ws = wb.active |
||
66 | ws.title = "MeterSubmetersBalance" |
||
67 | |||
68 | # Row height |
||
69 | ws.row_dimensions[1].height = 102 |
||
70 | for i in range(2, 2000 + 1): |
||
71 | ws.row_dimensions[i].height = 42 |
||
72 | |||
73 | # Col width |
||
74 | ws.column_dimensions['A'].width = 1.5 |
||
75 | |||
76 | ws.column_dimensions['B'].width = 25.0 |
||
77 | |||
78 | for i in range(ord('C'), ord('L')): |
||
79 | ws.column_dimensions[chr(i)].width = 15.0 |
||
80 | |||
81 | # Font |
||
82 | name_font = Font(name='Arial', size=15, bold=True) |
||
83 | title_font = Font(name='Arial', size=15, bold=True) |
||
84 | |||
85 | table_fill = PatternFill(fill_type='solid', fgColor='90ee90') |
||
86 | f_border = Border(left=Side(border_style='medium'), |
||
87 | right=Side(border_style='medium'), |
||
88 | bottom=Side(border_style='medium'), |
||
89 | top=Side(border_style='medium') |
||
90 | ) |
||
91 | b_border = Border( |
||
92 | bottom=Side(border_style='medium'), |
||
93 | ) |
||
94 | |||
95 | b_c_alignment = Alignment(vertical='bottom', |
||
96 | horizontal='center', |
||
97 | text_rotation=0, |
||
98 | wrap_text=True, |
||
99 | shrink_to_fit=False, |
||
100 | indent=0) |
||
101 | c_c_alignment = Alignment(vertical='center', |
||
102 | horizontal='center', |
||
103 | text_rotation=0, |
||
104 | wrap_text=True, |
||
105 | shrink_to_fit=False, |
||
106 | indent=0) |
||
107 | b_r_alignment = Alignment(vertical='bottom', |
||
108 | horizontal='right', |
||
109 | text_rotation=0, |
||
110 | wrap_text=True, |
||
111 | shrink_to_fit=False, |
||
112 | indent=0) |
||
113 | |||
114 | # Img |
||
115 | img = Image("excelexporters/myems.png") |
||
116 | ws.add_image(img, 'A1') |
||
117 | |||
118 | # Title |
||
119 | ws['B3'].alignment = b_r_alignment |
||
120 | ws['B3'] = _('Name') + ':' |
||
121 | ws['C3'].border = b_border |
||
122 | ws['C3'].alignment = b_c_alignment |
||
123 | ws['C3'] = name |
||
124 | |||
125 | ws['D3'].alignment = b_r_alignment |
||
126 | ws['D3'] = _('Period Type') + ':' |
||
127 | ws['E3'].border = b_border |
||
128 | ws['E3'].alignment = b_c_alignment |
||
129 | ws['E3'] = period_type |
||
130 | |||
131 | ws['B4'].alignment = b_r_alignment |
||
132 | ws['B4'] = _('Reporting Start Datetime') + ':' |
||
133 | ws['C4'].border = b_border |
||
134 | ws['C4'].alignment = b_c_alignment |
||
135 | ws['C4'] = reporting_start_datetime_local |
||
136 | |||
137 | ws['D4'].alignment = b_r_alignment |
||
138 | ws['D4'] = _('Reporting End Datetime') + ':' |
||
139 | ws['E4'].border = b_border |
||
140 | ws['E4'].alignment = b_c_alignment |
||
141 | ws['E4'] = reporting_end_datetime_local |
||
142 | |||
143 | if "reporting_period" not in report.keys() or \ |
||
144 | "difference_values" not in report['reporting_period'].keys() or \ |
||
145 | len(report['reporting_period']['difference_values']) == 0: |
||
146 | filename = str(uuid.uuid4()) + '.xlsx' |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
147 | wb.save(filename) |
||
148 | |||
149 | return filename |
||
150 | #################################################################################################################### |
||
151 | current_row_number = 6 |
||
152 | if 'difference_values' not in report['reporting_period'].keys() or len( |
||
153 | report['reporting_period']['difference_values']) == 0: |
||
154 | pass |
||
155 | else: |
||
156 | reporting_period_data = report['reporting_period'] |
||
157 | category = report['meter']['energy_category_name'] |
||
158 | |||
159 | ws['B' + str(current_row_number)].font = title_font |
||
160 | ws['B' + str(current_row_number)] = name + ' ' + _('Reporting Period') |
||
161 | |||
162 | current_row_number += 1 |
||
163 | |||
164 | ws.row_dimensions[current_row_number].height = 60 |
||
165 | |||
166 | ws['B' + str(current_row_number)].fill = table_fill |
||
167 | ws['B' + str(current_row_number)].border = f_border |
||
168 | if not isinstance(category, list): |
||
169 | ws['C' + str(current_row_number)].fill = table_fill |
||
170 | ws['C' + str(current_row_number)].font = name_font |
||
171 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
||
172 | ws['C' + str(current_row_number)].border = f_border |
||
173 | ws['C' + str(current_row_number)] = report['meter']['energy_category_name'] + " (" + report['meter'][ |
||
174 | 'unit_of_measure'] + ")" |
||
175 | |||
176 | current_row_number += 1 |
||
177 | |||
178 | ws['B' + str(current_row_number)].font = title_font |
||
179 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
||
180 | ws['B' + str(current_row_number)].border = f_border |
||
181 | ws['B' + str(current_row_number)] = _('Master Meter Consumption') |
||
182 | |||
183 | ws['C' + str(current_row_number)].font = name_font |
||
184 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
||
185 | ws['C' + str(current_row_number)].border = f_border |
||
186 | ws['C' + str(current_row_number)] = round2(reporting_period_data['master_meter_consumption_in_category'], 2) |
||
187 | |||
188 | current_row_number += 1 |
||
189 | |||
190 | ws['B' + str(current_row_number)].font = title_font |
||
191 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
||
192 | ws['B' + str(current_row_number)].border = f_border |
||
193 | ws['B' + str(current_row_number)] = _('Submeters Consumption') |
||
194 | |||
195 | ws['C' + str(current_row_number)].font = name_font |
||
196 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
||
197 | ws['C' + str(current_row_number)].border = f_border |
||
198 | ws['C' + str(current_row_number)] = round2(reporting_period_data['submeters_consumption_in_category'], 2) |
||
199 | |||
200 | current_row_number += 1 |
||
201 | |||
202 | ws['B' + str(current_row_number)].font = title_font |
||
203 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
||
204 | ws['B' + str(current_row_number)].border = f_border |
||
205 | ws['B' + str(current_row_number)] = _('Difference') |
||
206 | |||
207 | ws['C' + str(current_row_number)].font = name_font |
||
208 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
||
209 | ws['C' + str(current_row_number)].border = f_border |
||
210 | ws['C' + str(current_row_number)] = round2(reporting_period_data['difference_in_category'], 2) |
||
211 | |||
212 | current_row_number += 1 |
||
213 | |||
214 | ws['B' + str(current_row_number)].font = title_font |
||
215 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
||
216 | ws['B' + str(current_row_number)].border = f_border |
||
217 | ws['B' + str(current_row_number)] = _('Percentage Difference') |
||
218 | |||
219 | ws['C' + str(current_row_number)].font = name_font |
||
220 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
||
221 | ws['C' + str(current_row_number)].border = f_border |
||
222 | ws['C' + str(current_row_number)] = str( |
||
223 | round2(reporting_period_data['percentage_difference'] * 100, 2)) + '%' |
||
224 | |||
225 | current_row_number += 2 |
||
226 | |||
227 | time = reporting_period_data['timestamps'] |
||
228 | parameters_names_len = len(report['parameters']['names']) |
||
229 | parameters_data = report['parameters'] |
||
230 | parameters_parameters_datas_len = 0 |
||
231 | for i in range(0, parameters_names_len): |
||
232 | if len(parameters_data['timestamps'][i]) == 0: |
||
233 | continue |
||
234 | parameters_parameters_datas_len += 1 |
||
235 | has_time_data_flag = False |
||
236 | if time is not None and len(time) > 0: |
||
237 | has_time_data_flag = True |
||
238 | |||
239 | if has_time_data_flag: |
||
240 | |||
241 | ws['B' + str(current_row_number)].font = title_font |
||
242 | ws['B' + str(current_row_number)] = name + ' ' + _('Detailed Data') |
||
243 | |||
244 | current_row_number += 1 |
||
245 | chart_start_number = current_row_number |
||
246 | current_row_number = current_row_number + 1 + len(category) * 6 + parameters_parameters_datas_len * 6 |
||
247 | table_start_number = current_row_number |
||
248 | |||
249 | ws.row_dimensions[current_row_number].height = 60 |
||
250 | |||
251 | ws['B' + str(current_row_number)].fill = table_fill |
||
252 | ws['B' + str(current_row_number)].font = title_font |
||
253 | ws['B' + str(current_row_number)].border = f_border |
||
254 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
||
255 | ws['B' + str(current_row_number)] = _('Datetime') |
||
256 | |||
257 | ws['C' + str(current_row_number)].fill = table_fill |
||
258 | ws['C' + str(current_row_number)].font = title_font |
||
259 | ws['C' + str(current_row_number)].border = f_border |
||
260 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
||
261 | ws['C' + str(current_row_number)] = report['meter']['energy_category_name'] + " (" + report['meter'][ |
||
262 | 'unit_of_measure'] + ")" |
||
263 | |||
264 | current_row_number += 1 |
||
265 | |||
266 | for i in range(0, len(time)): |
||
267 | ws['B' + str(current_row_number)].font = title_font |
||
268 | ws['B' + str(current_row_number)].border = f_border |
||
269 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
||
270 | ws['B' + str(current_row_number)] = time[i] |
||
271 | |||
272 | ws['C' + str(current_row_number)].font = title_font |
||
273 | ws['C' + str(current_row_number)].border = f_border |
||
274 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
||
275 | ws['C' + str(current_row_number)] = round2(reporting_period_data['difference_values'][i], 2) |
||
276 | |||
277 | current_row_number += 1 |
||
278 | |||
279 | table_end_number = current_row_number - 1 |
||
280 | |||
281 | line = LineChart() |
||
282 | line.title = 'Difference - ' + report['meter']['energy_category_name'] + " (" + report['meter'][ |
||
283 | 'unit_of_measure'] + ")" |
||
284 | labels = Reference(ws, min_col=2, min_row=table_start_number + 1, max_row=table_end_number) |
||
285 | line_data = Reference(ws, min_col=3, min_row=table_start_number, max_row=table_end_number) |
||
286 | line.add_data(line_data, titles_from_data=True) |
||
287 | line.set_categories(labels) |
||
288 | line_data = line.series[0] |
||
289 | line_data.marker.symbol = "auto" |
||
290 | line_data.smooth = True |
||
291 | line.x_axis.crosses = 'min' |
||
292 | line.height = 8.25 |
||
293 | line.width = 24 |
||
294 | ws.add_chart(line, "B" + str(chart_start_number)) |
||
295 | |||
296 | ws['B' + str(current_row_number)].font = title_font |
||
297 | ws['B' + str(current_row_number)].border = f_border |
||
298 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
||
299 | ws['B' + str(current_row_number)] = _('Total') |
||
300 | |||
301 | ws['C' + str(current_row_number)].font = title_font |
||
302 | ws['C' + str(current_row_number)].border = f_border |
||
303 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
||
304 | ws['C' + str(current_row_number)] = \ |
||
305 | round2(reporting_period_data['master_meter_consumption_in_category'], 2) |
||
306 | |||
307 | else: |
||
308 | pass |
||
309 | |||
310 | #################################################################################################################### |
||
311 | # 12 is the starting line number of the last line chart in the report period |
||
312 | |||
313 | current_sheet_parameters_row_number = 14 + 1 * 6 |
||
314 | if 'parameters' not in report.keys() or \ |
||
315 | report['parameters'] is None or \ |
||
316 | 'names' not in report['parameters'].keys() or \ |
||
317 | report['parameters']['names'] is None or \ |
||
318 | len(report['parameters']['names']) == 0 or \ |
||
319 | 'timestamps' not in report['parameters'].keys() or \ |
||
320 | report['parameters']['timestamps'] is None or \ |
||
321 | len(report['parameters']['timestamps']) == 0 or \ |
||
322 | 'values' not in report['parameters'].keys() or \ |
||
323 | report['parameters']['values'] is None or \ |
||
324 | len(report['parameters']['values']) == 0 or \ |
||
325 | timestamps_data_all_equal_0(report['parameters']['timestamps']): |
||
326 | pass |
||
327 | else: |
||
328 | |||
329 | ################################################################################################################ |
||
330 | # new worksheet |
||
331 | ################################################################################################################ |
||
332 | |||
333 | parameters_data = report['parameters'] |
||
334 | |||
335 | parameters_names_len = len(parameters_data['names']) |
||
336 | |||
337 | file_name = (re.sub(r'[^A-Z]', '', ws.title))+'_' |
||
338 | parameters_ws = wb.create_sheet(file_name + _('Parameters')) |
||
339 | |||
340 | parameters_timestamps_data_max_len = \ |
||
341 | get_parameters_timestamps_lists_max_len(list(parameters_data['timestamps'])) |
||
342 | |||
343 | # Row height |
||
344 | parameters_ws.row_dimensions[1].height = 102 |
||
345 | for i in range(2, 7 + 1): |
||
346 | parameters_ws.row_dimensions[i].height = 42 |
||
347 | |||
348 | for i in range(8, parameters_timestamps_data_max_len + 10): |
||
349 | parameters_ws.row_dimensions[i].height = 60 |
||
350 | |||
351 | # Col width |
||
352 | parameters_ws.column_dimensions['A'].width = 1.5 |
||
353 | |||
354 | parameters_ws.column_dimensions['B'].width = 25.0 |
||
355 | |||
356 | for i in range(3, 12 + parameters_names_len * 3): |
||
357 | parameters_ws.column_dimensions[format_cell.get_column_letter(i)].width = 15.0 |
||
358 | |||
359 | # Img |
||
360 | img = Image("excelexporters/myems.png") |
||
361 | parameters_ws.add_image(img, 'A1') |
||
362 | |||
363 | # Title |
||
364 | parameters_ws['B3'].alignment = b_r_alignment |
||
365 | parameters_ws['B3'] = _('Name') + ':' |
||
366 | parameters_ws['C3'].border = b_border |
||
367 | parameters_ws['C3'].alignment = b_c_alignment |
||
368 | parameters_ws['C3'] = name |
||
369 | |||
370 | parameters_ws['D3'].alignment = b_r_alignment |
||
371 | parameters_ws['D3'] = _('Period Type') + ':' |
||
372 | parameters_ws['E3'].border = b_border |
||
373 | parameters_ws['E3'].alignment = b_c_alignment |
||
374 | parameters_ws['E3'] = period_type |
||
375 | |||
376 | parameters_ws['B4'].alignment = b_r_alignment |
||
377 | parameters_ws['B4'] = _('Reporting Start Datetime') + ':' |
||
378 | parameters_ws['C4'].border = b_border |
||
379 | parameters_ws['C4'].alignment = b_c_alignment |
||
380 | parameters_ws['C4'] = reporting_start_datetime_local |
||
381 | |||
382 | parameters_ws['D4'].alignment = b_r_alignment |
||
383 | parameters_ws['D4'] = _('Reporting End Datetime') + ':' |
||
384 | parameters_ws['E4'].border = b_border |
||
385 | parameters_ws['E4'].alignment = b_c_alignment |
||
386 | parameters_ws['E4'] = reporting_end_datetime_local |
||
387 | |||
388 | parameters_ws_current_row_number = 6 |
||
389 | |||
390 | parameters_ws['B' + str(parameters_ws_current_row_number)].font = title_font |
||
391 | parameters_ws['B' + str(parameters_ws_current_row_number)] = name + ' ' + _('Parameters') |
||
392 | |||
393 | parameters_ws_current_row_number += 1 |
||
394 | |||
395 | parameters_table_start_row_number = parameters_ws_current_row_number |
||
396 | |||
397 | parameters_ws.row_dimensions[parameters_ws_current_row_number].height = 80 |
||
398 | |||
399 | parameters_ws_current_row_number += 1 |
||
400 | |||
401 | table_current_col_number = 2 |
||
402 | |||
403 | for i in range(0, parameters_names_len): |
||
404 | |||
405 | if len(parameters_data['timestamps'][i]) == 0: |
||
406 | continue |
||
407 | |||
408 | col = format_cell.get_column_letter(table_current_col_number) |
||
409 | |||
410 | parameters_ws[col + str(parameters_ws_current_row_number - 1)].fill = table_fill |
||
411 | parameters_ws[col + str(parameters_ws_current_row_number - 1)].border = f_border |
||
412 | |||
413 | col = format_cell.get_column_letter(table_current_col_number + 1) |
||
414 | |||
415 | parameters_ws[col + str(parameters_ws_current_row_number - 1)].fill = table_fill |
||
416 | parameters_ws[col + str(parameters_ws_current_row_number - 1)].border = f_border |
||
417 | parameters_ws[col + str(parameters_ws_current_row_number - 1)].font = name_font |
||
418 | parameters_ws[col + str(parameters_ws_current_row_number - 1)].alignment = c_c_alignment |
||
419 | parameters_ws[col + str(parameters_ws_current_row_number - 1)] = parameters_data['names'][i] |
||
420 | |||
421 | table_current_row_number = parameters_ws_current_row_number |
||
422 | |||
423 | for j, value in enumerate(list(parameters_data['timestamps'][i])): |
||
424 | col = format_cell.get_column_letter(table_current_col_number) |
||
425 | |||
426 | parameters_ws[col + str(table_current_row_number)].border = f_border |
||
427 | parameters_ws[col + str(table_current_row_number)].font = title_font |
||
428 | parameters_ws[col + str(table_current_row_number)].alignment = c_c_alignment |
||
429 | parameters_ws[col + str(table_current_row_number)] = value |
||
430 | |||
431 | col = format_cell.get_column_letter(table_current_col_number + 1) |
||
432 | |||
433 | parameters_ws[col + str(table_current_row_number)].border = f_border |
||
434 | parameters_ws[col + str(table_current_row_number)].font = title_font |
||
435 | parameters_ws[col + str(table_current_row_number)].alignment = c_c_alignment |
||
436 | parameters_ws[col + str(table_current_row_number)] = round2(parameters_data['values'][i][j], 2) |
||
437 | |||
438 | table_current_row_number += 1 |
||
439 | |||
440 | table_current_col_number = table_current_col_number + 3 |
||
441 | |||
442 | ################################################################################################################ |
||
443 | # parameters chart and parameters table |
||
444 | ################################################################################################################ |
||
445 | |||
446 | ws['B' + str(current_sheet_parameters_row_number)].font = title_font |
||
447 | ws['B' + str(current_sheet_parameters_row_number)] = name + ' ' + _('Parameters') |
||
448 | |||
449 | current_sheet_parameters_row_number += 1 |
||
450 | |||
451 | chart_start_row_number = current_sheet_parameters_row_number |
||
452 | |||
453 | col_index = 0 |
||
454 | |||
455 | for i in range(0, parameters_names_len): |
||
456 | |||
457 | if len(parameters_data['timestamps'][i]) == 0: |
||
458 | continue |
||
459 | |||
460 | line = LineChart() |
||
461 | data_col = 3 + col_index * 3 |
||
462 | labels_col = 2 + col_index * 3 |
||
463 | col_index += 1 |
||
464 | line.title = 'Parameters - ' + \ |
||
465 | parameters_ws.cell(row=parameters_table_start_row_number, column=data_col).value |
||
466 | labels = Reference(parameters_ws, min_col=labels_col, min_row=parameters_table_start_row_number + 1, |
||
467 | max_row=(len(parameters_data['timestamps'][i]) + parameters_table_start_row_number)) |
||
468 | line_data = Reference(parameters_ws, min_col=data_col, min_row=parameters_table_start_row_number, |
||
469 | max_row=(len(parameters_data['timestamps'][i]) + parameters_table_start_row_number)) |
||
470 | line.add_data(line_data, titles_from_data=True) |
||
471 | line.set_categories(labels) |
||
472 | line_data = line.series[0] |
||
473 | line_data.marker.symbol = "auto" |
||
474 | line_data.smooth = True |
||
475 | line.x_axis.crosses = 'min' |
||
476 | line.height = 8.25 |
||
477 | line.width = 24 |
||
478 | chart_col = 'B' |
||
479 | chart_cell = chart_col + str(chart_start_row_number) |
||
480 | chart_start_row_number += 6 |
||
481 | ws.add_chart(line, chart_cell) |
||
482 | |||
483 | filename = str(uuid.uuid4()) + '.xlsx' |
||
484 | wb.save(filename) |
||
485 | |||
486 | return filename |
||
487 | |||
488 | |||
489 | def timestamps_data_all_equal_0(lists): |
||
490 | for i, value in enumerate(list(lists)): |
||
491 | if len(value) > 0: |
||
492 | return False |
||
493 | |||
494 | return True |
||
495 | |||
496 | |||
497 | def get_parameters_timestamps_lists_max_len(parameters_timestamps_lists): |
||
498 | max_len = 0 |
||
499 | for i, value in enumerate(list(parameters_timestamps_lists)): |
||
500 | if len(value) > max_len: |
||
501 | max_len = len(value) |
||
502 | |||
503 | return max_len |
||
504 | |||
505 | |||
506 | def timestamps_data_not_equal_0(lists): |
||
507 | number = 0 |
||
508 | for i, value in enumerate(list(lists)): |
||
509 | if len(value) > 0: |
||
510 | number += 1 |
||
511 | return number |
||
512 |