File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66from .. import format as odmlfmt
77from ..info import FORMAT_VERSION
8- from .parser_utils import InvalidVersionException , ParserException
8+ from .parser_utils import InvalidVersionException , ParserException , odml_tuple_export
99
1010
1111class DictWriter :
@@ -107,8 +107,8 @@ def get_properties(props_list):
107107 elif (tag == []) or tag : # Even if 'values' is empty, allow '[]'
108108 # Custom odML tuples require special handling.
109109 if attr == "values" and prop .dtype and \
110- prop .dtype .endswith ("-tuple" ) and len ( prop .values ) > 0 :
111- prop_dict ["value" ] = "(%s)" % ";" . join ( prop .values [ 0 ] )
110+ prop .dtype .endswith ("-tuple" ) and prop .values :
111+ prop_dict ["value" ] = odml_tuple_export ( prop .values )
112112 else :
113113 # Always use the arguments key attribute name when saving
114114 prop_dict [i ] = tag
Original file line number Diff line number Diff line change 2222
2323from .. import format as ofmt
2424from ..info import FORMAT_VERSION
25- from .parser_utils import InvalidVersionException , ParserException
25+ from .parser_utils import InvalidVersionException , ParserException , odml_tuple_export
2626
2727try :
2828 unicode = unicode
@@ -121,8 +121,8 @@ def save_element(curr_el):
121121 continue
122122 if isinstance (fmt , ofmt .Property .__class__ ) and k == "value" :
123123 # Custom odML tuples require special handling for save loading from file.
124- if curr_el .dtype and curr_el .dtype .endswith ("-tuple" ) and len ( val ) > 0 :
125- ele = E (k , "(%s)" % ";" . join ( val [ 0 ] ))
124+ if curr_el .dtype and curr_el .dtype .endswith ("-tuple" ) and val :
125+ ele = E (k , odml_tuple_export ( val ))
126126 else :
127127 ele = E (k , to_csv (val ))
128128 cur .append (ele )
You can’t perform that action at this time.
0 commit comments