Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(69)

Side by Side Diff: Lib/plistlib.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/plat-linux3/TYPES.py ('k') | Lib/profile.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 r"""plistlib.py -- a tool to generate and parse MacOSX .plist files. 1 r"""plistlib.py -- a tool to generate and parse MacOSX .plist files.
2 2
3 The property list (.plist) file format is a simple XML pickle supporting 3 The property list (.plist) file format is a simple XML pickle supporting
4 basic object types, like dictionaries, lists, numbers and strings. 4 basic object types, like dictionaries, lists, numbers and strings.
5 Usually the top level object is a dictionary. 5 Usually the top level object is a dictionary.
6 6
7 To write out a plist file, use the writePlist(rootObject, pathOrFile) 7 To write out a plist file, use the writePlist(rootObject, pathOrFile)
8 function. 'rootObject' is the top level object, 'pathOrFile' is a 8 function. 'rootObject' is the top level object, 'pathOrFile' is a
9 filename or a (writable) file object. 9 filename or a (writable) file object.
10 10
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 # we only need to warn when a *user* instantiates Dict or when 259 # we only need to warn when a *user* instantiates Dict or when
260 # the "attribute notation for dict keys" is used. 260 # the "attribute notation for dict keys" is used.
261 261
262 def __getattr__(self, attr): 262 def __getattr__(self, attr):
263 try: 263 try:
264 value = self[attr] 264 value = self[attr]
265 except KeyError: 265 except KeyError:
266 raise AttributeError(attr) 266 raise AttributeError(attr)
267 from warnings import warn 267 from warnings import warn
268 warn("Attribute access from plist dicts is deprecated, use d[key] " 268 warn("Attribute access from plist dicts is deprecated, use d[key] "
269 "notation instead", DeprecationWarning, 2) 269 "notation instead", PendingDeprecationWarning, 2)
270 return value 270 return value
271 271
272 def __setattr__(self, attr, value): 272 def __setattr__(self, attr, value):
273 from warnings import warn 273 from warnings import warn
274 warn("Attribute access from plist dicts is deprecated, use d[key] " 274 warn("Attribute access from plist dicts is deprecated, use d[key] "
275 "notation instead", DeprecationWarning, 2) 275 "notation instead", PendingDeprecationWarning, 2)
276 self[attr] = value 276 self[attr] = value
277 277
278 def __delattr__(self, attr): 278 def __delattr__(self, attr):
279 try: 279 try:
280 del self[attr] 280 del self[attr]
281 except KeyError: 281 except KeyError:
282 raise AttributeError(attr) 282 raise AttributeError(attr)
283 from warnings import warn 283 from warnings import warn
284 warn("Attribute access from plist dicts is deprecated, use d[key] " 284 warn("Attribute access from plist dicts is deprecated, use d[key] "
285 "notation instead", DeprecationWarning, 2) 285 "notation instead", PendingDeprecationWarning, 2)
286 286
287 class Dict(_InternalDict): 287 class Dict(_InternalDict):
288 288
289 def __init__(self, **kwargs): 289 def __init__(self, **kwargs):
290 from warnings import warn 290 from warnings import warn
291 warn("The plistlib.Dict class is deprecated, use builtin dict instead", 291 warn("The plistlib.Dict class is deprecated, use builtin dict instead",
292 DeprecationWarning, 2) 292 PendingDeprecationWarning, 2)
293 super().__init__(**kwargs) 293 super().__init__(**kwargs)
294 294
295 295
296 class Plist(_InternalDict): 296 class Plist(_InternalDict):
297 297
298 """This class has been deprecated. Use readPlist() and writePlist() 298 """This class has been deprecated. Use readPlist() and writePlist()
299 functions instead, together with regular dict objects. 299 functions instead, together with regular dict objects.
300 """ 300 """
301 301
302 def __init__(self, **kwargs): 302 def __init__(self, **kwargs):
303 from warnings import warn 303 from warnings import warn
304 warn("The Plist class is deprecated, use the readPlist() and " 304 warn("The Plist class is deprecated, use the readPlist() and "
305 "writePlist() functions instead", DeprecationWarning, 2) 305 "writePlist() functions instead", PendingDeprecationWarning, 2)
306 super().__init__(**kwargs) 306 super().__init__(**kwargs)
307 307
308 def fromFile(cls, pathOrFile): 308 def fromFile(cls, pathOrFile):
309 """Deprecated. Use the readPlist() function instead.""" 309 """Deprecated. Use the readPlist() function instead."""
310 rootObject = readPlist(pathOrFile) 310 rootObject = readPlist(pathOrFile)
311 plist = cls() 311 plist = cls()
312 plist.update(rootObject) 312 plist.update(rootObject)
313 return plist 313 return plist
314 fromFile = classmethod(fromFile) 314 fromFile = classmethod(fromFile)
315 315
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 def end_integer(self): 439 def end_integer(self):
440 self.addObject(int(self.getData())) 440 self.addObject(int(self.getData()))
441 def end_real(self): 441 def end_real(self):
442 self.addObject(float(self.getData())) 442 self.addObject(float(self.getData()))
443 def end_string(self): 443 def end_string(self):
444 self.addObject(self.getData()) 444 self.addObject(self.getData())
445 def end_data(self): 445 def end_data(self):
446 self.addObject(Data.fromBase64(self.getData().encode("utf-8"))) 446 self.addObject(Data.fromBase64(self.getData().encode("utf-8")))
447 def end_date(self): 447 def end_date(self):
448 self.addObject(_dateFromString(self.getData())) 448 self.addObject(_dateFromString(self.getData()))
OLDNEW
« no previous file with comments | « Lib/plat-linux3/TYPES.py ('k') | Lib/profile.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+