Completed
Push — master ( 01d65b...727c7c )
by Jeffrey
06:28 queued 03:06
created

print_colorized_frame()   A

Complexity

Conditions 4

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 14
rs 9.2
1
# These imports are for python3 compatibility inside python2
2
from __future__ import absolute_import
3
from __future__ import division
4
from __future__ import print_function
5
6
import click
7
8
9
def print_colorized_frame(frame, port_name, direction_in):
10
    formatted_aprs = '>'.join([click.style(frame['source'], fg='green'), click.style(frame['destination'], fg='blue')])
11
    paths = []
12
    for path in frame['path']:
13
        paths.append(click.style(path, fg='cyan'))
14
    paths = ','.join(paths)
15
    if frame['path']:
16
        formatted_aprs = ','.join([formatted_aprs, paths])
17
    formatted_aprs += ':'
18
    formatted_aprs += frame['text']
19
    if direction_in:
20
        click.echo(click.style(port_name + ' << ', fg='magenta') + formatted_aprs)
21
    else:
22
        click.echo(click.style(port_name + ' >> ', fg='magenta', bold=True, blink=True) + formatted_aprs)
23