Ralph Bean avatar Ralph Bean committed 1968186

A few more 2/3 mods.

Comments (0)

Files changed (1)


 """An HTML to XHTML converter."""
 from __future__ import print_function
 import re
-import htmlentitydefs
 import codecs
 import encodings.aliases
 import six
+from six.moves import html_entities as htmlentitydefs
 __all__ = [
 def sniff_encoding(xml):
     """Detects the XML encoding as per XML 1.0 section F.1."""
-    if isinstance(xml, str):
+    if isinstance(xml, six.binary_type):
         xmlstr = xml
-    elif isinstance(xml, basestring):
+    elif isinstance(xml, six.text_type):
         xmlstr = xml.encode('utf-8')
         raise TypeError('Expected a string, got %r' % type(xml))
        If the returned encoding is lowercase it means the BOM uniquely
        identified an encoding, so we don't need to parse the <?xml...?>
        to extract the encoding in theory."""
-    if not isinstance(xml, str):
-        raise TypeError('Expected str, got %r' % type(xml))
+    if not isinstance(xml, six.binary_type):
+        raise TypeError('Expected str/bytes, got %r' % type(xml))
     # Warning: The UTF-32 codecs aren't present before Python 2.6...
     # See also http://bugs.python.org/issue1399
     enc = {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.