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

Side by Side Diff: Lib/xml/dom/pulldom.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/webbrowser.py ('k') | Lib/xml/etree/ElementInclude.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 import xml.sax 1 import xml.sax
2 import xml.sax.handler 2 import xml.sax.handler
3 import types 3 import types
4 4
5 START_ELEMENT = "START_ELEMENT" 5 START_ELEMENT = "START_ELEMENT"
6 END_ELEMENT = "END_ELEMENT" 6 END_ELEMENT = "END_ELEMENT"
7 COMMENT = "COMMENT" 7 COMMENT = "COMMENT"
8 START_DOCUMENT = "START_DOCUMENT" 8 START_DOCUMENT = "START_DOCUMENT"
9 END_DOCUMENT = "END_DOCUMENT" 9 END_DOCUMENT = "END_DOCUMENT"
10 PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION" 10 PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 parentNode = self.elementStack[-1] 319 parentNode = self.elementStack[-1]
320 parentNode.appendChild(node) 320 parentNode.appendChild(node)
321 321
322 322
323 default_bufsize = (2 ** 14) - 20 323 default_bufsize = (2 ** 14) - 20
324 324
325 def parse(stream_or_string, parser=None, bufsize=None): 325 def parse(stream_or_string, parser=None, bufsize=None):
326 if bufsize is None: 326 if bufsize is None:
327 bufsize = default_bufsize 327 bufsize = default_bufsize
328 if isinstance(stream_or_string, str): 328 if isinstance(stream_or_string, str):
329 stream = open(stream_or_string, 'rb') 329 stream = open(stream_or_string)
330 else: 330 else:
331 stream = stream_or_string 331 stream = stream_or_string
332 if not parser: 332 if not parser:
333 parser = xml.sax.make_parser() 333 parser = xml.sax.make_parser()
334 return DOMEventStream(stream, parser, bufsize) 334 return DOMEventStream(stream, parser, bufsize)
335 335
336 def parseString(string, parser=None): 336 def parseString(string, parser=None):
337 try: 337 try:
338 from io import StringIO 338 from io import StringIO
339 except ImportError: 339 except ImportError:
340 from io import StringIO 340 from io import StringIO
341 341
342 bufsize = len(string) 342 bufsize = len(string)
343 buf = StringIO(string) 343 buf = StringIO(string)
344 if not parser: 344 if not parser:
345 parser = xml.sax.make_parser() 345 parser = xml.sax.make_parser()
346 return DOMEventStream(buf, parser, bufsize) 346 return DOMEventStream(buf, parser, bufsize)
OLDNEW
« no previous file with comments | « Lib/webbrowser.py ('k') | Lib/xml/etree/ElementInclude.py » ('j') | no next file with comments »

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