File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,3 +34,24 @@ class InvalidVersionException(ParserException):
3434 Exception wrapper to indicate a non-compatible odML version.
3535 """
3636 pass
37+
38+
39+ def odml_tuple_export (odml_tuples ):
40+ """
41+ Converts odml style tuples to a parsable string representation.
42+ Every tuple is represented by brackets '()'. The individual elements of a tuple are
43+ separated by a semicolon ';'. The individual tuples are separated by a comma ','.
44+ An odml 3-tuple list of 2 tuples would be serialized to: "[(11;12;13),(21;22;23)]".
45+
46+ :param odml_tuples: List of odml style tuples.
47+ :return: string
48+ """
49+ str_tuples = ""
50+ for val in odml_tuples :
51+ str_val = ";" .join (val )
52+ if str_tuples :
53+ str_tuples = "%s,(%s)" % (str_tuples , str_val )
54+ else :
55+ str_tuples = "(%s)" % str_val
56+
57+ return "[%s]" % str_tuples
You can’t perform that action at this time.
0 commit comments