1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

python/samba/graph: use look up table for ascii-art charsets

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2018-05-15 22:26:43 +12:00 committed by Andrew Bartlett
parent 9353a580f8
commit 4f7638f8ab

View File

@ -439,6 +439,27 @@ COLOUR_SETS = {
}
}
CHARSETS = {
'utf8': {
'vertical': '',
'horizontal': '',
'corner': '',
#'diagonal': '╲',
'diagonal': '·',
#'missing': '🕱',
'missing': '-',
'right_arrow': '',
},
'ascii': {
'vertical': '|',
'horizontal': '-',
'corner': ',',
'diagonal': '0',
'missing': '-',
'right_arrow': '<-',
}
}
def find_transitive_distance(vertices, edges):
all_vertices = (set(vertices) |
@ -518,18 +539,13 @@ def distance_matrix(vertices, edges,
lines = []
write = lines.append
if utf8:
vertical = ''
horizontal = ''
corner = ''
#diagonal = '╲'
diagonal = '·'
#missing = '🕱'
missing = '-'
right_arrow = ''
else:
vertical, horizontal, corner, diagonal, missing = '|-,0-'
right_arrow = '<-'
charset = CHARSETS['utf8' if utf8 else 'ascii']
vertical = charset['vertical']
horizontal = charset['horizontal']
corner = charset['corner']
diagonal = charset['diagonal']
missing = charset['missing']
right_arrow = charset['right_arrow']
colours = COLOUR_SETS[colour]