Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
frame = frame_hash[idx]
frame_style = sty_first_frame
# sort signals:
sig_hash = {"{:02d}{}".format(sig.get_startbit(), sig.name): sig for sig in frame.signals}
# set style for first line with border
sig_style = sty_first_frame
additional_frame_info = [frame.attribute(frameInfo, default="") for frameInfo in additional_frame_columns]
# iterate over signals
row_array = []
if len(sig_hash) == 0: # Frames without signals
row_array += canmatrix.formats.xls_common.get_frame_info(db, frame)
for _ in range(5, head_start):
row_array.append("")
temp_col = write_excel_line(worksheet, row, 0, row_array, frame_style)
temp_col = write_ecu_matrix(ecu_list, None, frame, worksheet, row, temp_col, frame_style)
row_array = []
for col in range(temp_col, additional_frame_start):
row_array.append("")
row_array += additional_frame_info
for _ in additional_signal_columns:
row_array.append("")
write_excel_line(worksheet, row, temp_col, row_array, frame_style)
row += 1
continue
# iterate over signals
frame = frame_hash[idx]
frame_style = sty_first_frame
# sort signals:
sig_hash = {}
for sig in frame.signals:
sig_hash["%02d" % int(sig.get_startbit()) + sig.name] = sig
# set style for first line with border
signal_style = sty_first_frame
additional_frame_info = [frame.attribute(additional, default="") for additional in additional_frame_columns]
row_array = []
if len(sig_hash) == 0:
row_array += canmatrix.formats.xls_common.get_frame_info(db, frame)
for _ in range(5, head_start):
row_array.append("")
temp_col = write_excel_line(worksheet, row, 0, row_array, frame_style)
temp_col = write_ecu_matrix(ecu_list, None, frame, worksheet, row, temp_col, frame_style)
row_array = ["" for _ in range(temp_col, additional_frame_start)]
row_array += additional_frame_info
row_array += ["" for _ in additional_signal_columns]
write_excel_line(worksheet, row, temp_col, row_array, frame_style)
row += 1
# iterate over signals
for sig_idx in sorted(sig_hash.keys()):
sig = sig_hash[sig_idx]
# if not first Signal in Frame, set style
additional_frame_info = [
frame.attribute(frameInfo, default="")
for frameInfo in additional_frame_columns
]
# iterate over signals
for sig_idx in sorted(signal_hash.keys()):
sig = signal_hash[sig_idx]
# value table available?
if sig.values.__len__() > 0:
# iterate over values in value table
for val in sorted(sig.values.keys()):
signal_row = CsvRow()
signal_row += canmatrix.formats.xls_common.get_frame_info(db, frame)
(front, back) = canmatrix.formats.xls_common.get_signal(db, sig, motorola_bit_format)
signal_row += front
signal_row += ("s" if sig.is_signed else "u")
col = head_top.__len__()
write_ecu_matrix(ecu_name_list, sig, frame, signal_row, col)
signal_row += back
# write Value
signal_row += [val, sig.values[val]]
signal_row += additional_frame_info
for item in additional_signal_columns:
temp = getattr(sig, item, "")
signal_row += [temp]
frame.attribute(frameInfo, default="")
for frameInfo in additional_frame_columns
]
# iterate over signals
for sig_idx in sorted(signal_hash.keys()):
sig = signal_hash[sig_idx]
# value table available?
if sig.values.__len__() > 0:
# iterate over values in value table
for val in sorted(sig.values.keys()):
signal_row = CsvRow()
signal_row += canmatrix.formats.xls_common.get_frame_info(db, frame)
(front, back) = canmatrix.formats.xls_common.get_signal(db, sig, motorola_bit_format)
signal_row += front
signal_row += ("s" if sig.is_signed else "u")
col = head_top.__len__()
write_ecu_matrix(ecu_name_list, sig, frame, signal_row, col)
signal_row += back
# write Value
signal_row += [val, sig.values[val]]
signal_row += additional_frame_info
for item in additional_signal_columns:
temp = getattr(sig, item, "")
signal_row += [temp]
# next row
row += 1
row += 1
# iterate over signals
for sig_idx in sorted(sig_hash.keys()):
sig = sig_hash[sig_idx]
# if not first Signal in Frame, set style
if signal_style != sty_first_frame:
signal_style = sty_norm
# valuetable available?
if len(sig.values) > 0 and not values_in_seperate_lines:
value_style = signal_style
# iterate over values in valuetable
for val in sorted(sig.values.keys()):
row_array = canmatrix.formats.xls_common.get_frame_info(db, frame)
front_col = write_excel_line(worksheet, row, 0, row_array, frame_style)
if frame_style != sty_first_frame:
worksheet.set_row(row, None, None, {'level': 1})
col = head_start
col = write_ecu_matrix(ecu_list, sig, frame, worksheet, row, col, frame_style)
# write Value
(frontRow, back_row) = canmatrix.formats.xls_common.get_signal(db, sig, motorola_bit_format)
write_excel_line(worksheet, row, front_col, frontRow, signal_style)
back_row += additional_frame_info
for item in additional_signal_columns:
temp = getattr(sig, item, "")
back_row.append(temp)
sig_style = sty_norm
if sig.values.__len__() > 0: # signals with value table
val_style = sig_style
# iterate over values in value table
for val in sorted(sig.values.keys()):
row_array = canmatrix.formats.xls_common.get_frame_info(db, frame)
front_col = write_excel_line(worksheet, row, 0, row_array, frame_style)
if frame_style != sty_first_frame:
worksheet.row(row).level = 1
col = head_start
col = write_ecu_matrix(ecu_list, sig, frame, worksheet, row, col, frame_style)
# write Value
(frontRow, backRow) = canmatrix.formats.xls_common.get_signal(db, sig, motorola_bit_format)
write_excel_line(worksheet, row, front_col, frontRow, sig_style)
backRow += additional_frame_info
for item in additional_signal_columns:
temp = getattr(sig, item, "")
backRow.append(temp)
write_excel_line(worksheet, row, col + 2, backRow, sig_style)
write_excel_line(worksheet, row, col, [val, sig.values[val]], val_style)
# no min/max here, because min/max has same col as values...
# next row
row += 1
# set style to normal - without border
sig_style = sty_white
frame_style = sty_white
val_style = sty_norm