diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-22 22:44:31 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-22 22:48:37 +0100 |
commit | 66f9bc2f4ce9dfb7f90369fc23c3093c2e7835bb (patch) | |
tree | 620c67f6d6ba494aff66faacdbc9c86a89271aeb /use2dot/change_graph.py | |
parent | Add script to find unused imports. (diff) | |
download | calp-66f9bc2f4ce9dfb7f90369fc23c3093c2e7835bb.tar.gz calp-66f9bc2f4ce9dfb7f90369fc23c3093c2e7835bb.tar.xz |
Complete rewrite of use2dot
Old version tried to leverage guile's built in use2dot, and then
modified it to fit my needs. This new version implements its own
use2dot, using the same underlying mechanism as guile's built in,
giving us FAR greater flexability.
Diffstat (limited to '')
-rwxr-xr-x | use2dot/change_graph.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/use2dot/change_graph.py b/use2dot/change_graph.py deleted file mode 100755 index 50d1c34f..00000000 --- a/use2dot/change_graph.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python3 - -import re -import colorsys -import hashlib -import sys - -def md5(str): - return hashlib.md5(str.encode("UTF-8")).hexdigest() - -def rgb(str): - return md5(str)[0:6] - -def main(args): - - if len(args) < 3: - print("Usage: ./change_graph.py <infile> <outfile>") - return - - [_, infile, outfile, *rest] = args - - with open(infile) as f: - lines = f.readlines() - # [3:-1] - - f = open(outfile, 'w') - - for line in lines: - m = re.search('^( *"\(([^)]*)\)" -> "(\([^)]*\))");', line) - if m: - f.write(f'{m.group(1)} [color="#{rgb(m.group(2))}"];\n') - else: - f.write(line) - # colorsys.hsv_to_rgb( - - -# "(server macro)" -> "(ice-9 regex)"; - -if __name__ == "__main__": - main(sys.argv) |