Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chainedconfigparser.py

Issue 29756621: Issue 6552 - call setdefault() on correct dictionary (Closed)
Patch Set: Created April 19, 2018, 12:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 import os 5 import os
6 import io 6 import io
7 import ConfigParser 7 import ConfigParser
8 from StringIO import StringIO 8 from StringIO import StringIO
9 9
10 10
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 if v == 'bool:false': 209 if v == 'bool:false':
210 return False 210 return False
211 return v 211 return v
212 212
213 if self.has_section(section): 213 if self.has_section(section):
214 for k, v in self.items(section): 214 for k, v in self.items(section):
215 parents = k.split('.') 215 parents = k.split('.')
216 tail = parents.pop() 216 tail = parents.pop()
217 current = base 217 current = base
218 for name in parents: 218 for name in parents:
219 current = base.setdefault(name, {}) 219 current = current.setdefault(name, {})
220 220
221 if '\n' in v: 221 if '\n' in v:
222 current[tail] = [parse_value(x) for x in v.splitlines() if x ] 222 current[tail] = [parse_value(x) for x in v.splitlines() if x ]
223 else: 223 else:
224 current[tail] = parse_value(v) 224 current[tail] = parse_value(v)
225 225
226 def readfp(self, fp, filename=None): 226 def readfp(self, fp, filename=None):
227 raise NotImplementedError 227 raise NotImplementedError
228 228
229 def set(self, section, option, value=None): 229 def set(self, section, option, value=None):
230 raise NotImplementedError 230 raise NotImplementedError
231 231
232 def add_section(self, section): 232 def add_section(self, section):
233 raise NotImplementedError 233 raise NotImplementedError
234 234
235 def remove_option(self, section, option): 235 def remove_option(self, section, option):
236 raise NotImplementedError 236 raise NotImplementedError
237 237
238 def remove_section(self, section): 238 def remove_section(self, section):
239 raise NotImplementedError 239 raise NotImplementedError
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld