graph: only replace allowed characters which are -,+,_
This commit is contained in:
+1
-2
@@ -139,8 +139,7 @@ class Digraph(object):
|
|||||||
def id_str(self, u):
|
def id_str(self, u):
|
||||||
# Graph format only accepts underscores as key values
|
# Graph format only accepts underscores as key values
|
||||||
# Sanitize the values. This is 2x faster than the old method.
|
# Sanitize the values. This is 2x faster than the old method.
|
||||||
return ''.join([ch if ch not in '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' \
|
return u.replace("-", "_").replace("+", "_")
|
||||||
else '_' for ch in u])
|
|
||||||
|
|
||||||
def write_graphviz(self, f):
|
def write_graphviz(self, f):
|
||||||
f.write('digraph G {\n')
|
f.write('digraph G {\n')
|
||||||
|
|||||||
Reference in New Issue
Block a user