Commit 5320d59f authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

fix prefix handling in for/history option


git-svn-id: https://svn.forked.de/graph-tool/trunk@61 d4600afd-f417-0410-95de-beed9576f240
parent 7e06567e
...@@ -781,9 +781,11 @@ def open_file(name, mode="w"): ...@@ -781,9 +781,11 @@ def open_file(name, mode="w"):
return gzip.GzipFile(name, mode) return gzip.GzipFile(name, mode)
return file(name, mode) return file(name, mode)
def write_data(data, file, prefix=""): def write_data(data, file, prefix=None):
if prefix != "": if prefix != None:
prefix = "%s\t" % prefix prefix = "%s\t" % prefix
else:
prefix = ""
if data.__class__ == dict: if data.__class__ == dict:
# it is a histogram # it is a histogram
keys = data.keys() keys = data.keys()
...@@ -905,7 +907,7 @@ try: ...@@ -905,7 +907,7 @@ try:
retval = parse_option(opt) retval = parse_option(opt)
if retval != None: if retval != None:
if retval[1] != None: if retval[1] != None:
prefix = "" prefix = None
if retval[1] == "-": if retval[1] == "-":
if opt.value.strip() != "-": if opt.value.strip() != "-":
print "#",opt.name.replace("-"," "), "("+opt.value.replace("|",", ").replace(", -","")+"):" print "#",opt.name.replace("-"," "), "("+opt.value.replace("|",", ").replace(", -","")+"):"
...@@ -917,7 +919,8 @@ try: ...@@ -917,7 +919,8 @@ try:
# deal with history # deal with history
if history_range != None: if history_range != None:
class MyTemplate(string.Template): from string import Template
class MyTemplate(Template):
delimiter = "%" delimiter = "%"
values = parse_values(history_range.value) values = parse_values(history_range.value)
if len(values) != 3: if len(values) != 3:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment