summaryrefslogtreecommitdiff
path: root/python/samba/kcc/graph_utils.py
AgeCommit message (Collapse)AuthorFilesLines
2021-04-28python: remove all 'from __future__ import print_function'Douglas Bagnall1-1/+0
This made Python 2's print behave like Python 3's print(). In some cases, where we had: from __future__ import print_function """Intended module documentation...""" this will have the side effect of making the intended module documentation work as the actual module documentation (i.e. becoming __doc__), because it is once again the first statement in the module. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-06-10python/kcc/graph_utils: short-cut edge failure test without edgesDouglas Bagnall1-0/+3
Otherwise we get an exception because itertools.combinations is asked to find combinations with negative size. Instead we assert the graph is connected as-is, which in this case is the same as asserting there are no vertices. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-31python kcc/graph_utils: don't debug in colourDouglas Bagnall1-5/+3
this was somewhat useful during the initial development, but is wrong for a library Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-31kcc graph verifiers: improve messagesDouglas Bagnall1-10/+15
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-31kcc graph verifier: use __doc__ description for error explanationDouglas Bagnall1-4/+4
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-31kcc.graph_utils: shift debug noise out of verify()Douglas Bagnall1-26/+17
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-04-13kcc/kcc_utils: convert dict.keys to listJoe Guo1-1/+1
In py3, `dict.keys()` will return a iterator not a list. Convert it to list to support both py2 and py3. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-04-13kcc/graph_utils: port string.translate for py3Joe Guo1-1/+1
In py3, `str.translate` removed the second positional argument `deletechars`, which means you can not use it to delete chars from str. Use `replace` for this case. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-03-23samba python libs: convert print func to be py2/py3 compatibleNoel Power1-3/+4
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-02-15samba python libs: convert 'except X, e' to 'except X as e'Douglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-01-13samba_kcc: use new graph module for writing dot filesDouglas Bagnall1-30/+7
We avoid changing the (annoying) signature of write_dot_file(). Using samba_kcc to write dot files may be deprecated. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-06-23samba_kcc: avoid crash on odd networks with --dot-file-dirDouglas Bagnall1-0/+4
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-06-12KCC: pep8 -- remove an extra line in graph_utilsDouglas Bagnall1-1/+0
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12KCC: remove "forest_of_rings" verification checkDouglas Bagnall1-6/+0
Because it didn't actually check anything. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12KCC: write dot files in a deterministic, user specified placeDouglas Bagnall1-12/+17
We were using randomised tempfile names in /tmp, initially to avoid overwriting previous runs so as to track progress. Now we hardly ever care about the old versions, and a user-specified name will be handy for testing. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12KCC: split and shift samba.graph_utils -> samba.kcc.{graph_utils,debug}Douglas Bagnall1-0/+367
The debug module contains debug functions and colours. Graph_utils keeps the DOT file generation and graph verification code. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>