@@ -167,11 +167,11 @@ def as_list(self):
167167 return [self .name , self .value , ret ]
168168
169169 def as_dict (self ):
170- return {'{} {}' .format (self .name , self .value ): [x .as_dict () for x in self .blocks ]}
170+ return {'{0 } {1 }' .format (self .name , self .value ): [x .as_dict () for x in self .blocks ]}
171171
172172 def as_block (self ):
173173 ret = []
174- ret .append ('{} {} {{\n ' .format (self .name , self .value ))
174+ ret .append ('{0 } {1 } {{\n ' .format (self .name , self .value ))
175175 for x in self .blocks :
176176 if isinstance (x , (Key , Comment )):
177177 ret .append (INDENT + x .as_block ())
@@ -198,7 +198,7 @@ def as_dict(self):
198198 return {'#' : self .comment }
199199
200200 def as_block (self ):
201- return '# {}\n ' .format (self .comment )
201+ return '# {0 }\n ' .format (self .comment )
202202
203203
204204class Location (Container ):
@@ -243,7 +243,7 @@ def as_dict(self):
243243 return {self .name : self .value }
244244
245245 def as_block (self ):
246- return '{} {};\n ' .format (self .name , self .value )
246+ return '{0 } {1 };\n ' .format (self .name , self .value )
247247
248248
249249def loads (data , conf = True ):
@@ -267,8 +267,9 @@ def loads(data, conf=True):
267267 lopen .insert (0 , u )
268268 if re .match ('.*;' , line ):
269269 kname , kval = re .match ('.*(?:^|^\s*|{\s*)(\S+)\s(.+);' , line ).group (1 , 2 )
270- k = Key (kname , kval )
271- lopen [0 ].add (k )
270+ if "#" not in kname :
271+ k = Key (kname , kval )
272+ lopen [0 ].add (k )
272273 if re .match ('.*}' , line ):
273274 closenum = len (re .findall ('}' , line ))
274275 while closenum > 0 :
0 commit comments