Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
col_width,
cards_by_id,
):
line_parts = [f"{dt:%H:%M} --" if is_tick else " " * 8]
fill_char = "-" if is_tick else " "
room = rooms[0]
start, run, end = (
starting_events[room],
running_events[room],
ending_events[room],
)
if start or end:
line_parts.append(
get_seperator(bool(end), bool(start), False, False) + LR * col_width
)
elif run:
line_parts.append(UD + next(cards_by_id[run.pk]))
else:
line_parts.append(fill_char * (col_width + 1))
for loc1, loc2 in zip(rooms[:-1], rooms[1:]):
start1, run1, end1 = (
starting_events[loc1],
running_events[loc1],
ending_events[loc1],
)
start2, run2, end2 = (
starting_events[loc2],
running_events[loc2],
ending_events[loc2],
if run2:
line_parts.append(next(cards_by_id[run2.pk]))
elif start2 or end2:
line_parts.append(LR * col_width)
else:
line_parts.append(fill_char * col_width)
room = rooms[-1]
start, run, end = (
starting_events[room],
running_events[room],
ending_events[room],
)
if start or end:
line_parts.append(get_seperator(False, False, bool(start), bool(end)))
elif run:
line_parts.append(UD)
else:
line_parts.append(fill_char)
return "".join(line_parts)
def _get_line_parts(start1, start2, end1, end2, run1, run2, fill_char):
start_end = [end2, start2, start1, end1]
result = []
if run1 and (start2 or end2):
result.append("├")
elif run2 and (start1 or end1):
result.append("┤")
elif any(start_end):
result.append(get_seperator(*map(bool, start_end)))
elif run1 or run2:
result.append(UD)
else:
result.append(fill_char)
return result