From a5b617e5f09af255783ad87acde0e7fbd6fb0cbe Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Mon, 21 Feb 2011 17:24:18 -0500 Subject: Minor cleanup. --- beautifulsoup/dammit.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'beautifulsoup/dammit.py') diff --git a/beautifulsoup/dammit.py b/beautifulsoup/dammit.py index f0690c1..0d3ebd0 100644 --- a/beautifulsoup/dammit.py +++ b/beautifulsoup/dammit.py @@ -7,6 +7,7 @@ encoding; that's the tree builder's job. """ import codecs +from htmlentitydefs import codepoint2name import re import types @@ -21,21 +22,13 @@ try: except ImportError: chardet = None -# Both are available from http://cjkpython.i18n.org/ -# They're built in if you use Python 2.4. -try: - import cjkcodecs.aliases -except ImportError: - pass +# Available from http://cjkpython.i18n.org/. try: import iconv_codec except ImportError: pass -from htmlentitydefs import codepoint2name -import re - class EntitySubstitution(object): def _populate_class_variables(): @@ -47,7 +40,6 @@ class EntitySubstitution(object): lookup[character] = name re_definition = "[%s]" % "".join(characters) return lookup, re.compile(re_definition) - CHARACTER_TO_HTML_ENTITY, CHARACTER_TO_HTML_ENTITY_RE = ( _populate_class_variables()) @@ -157,8 +149,6 @@ class EntitySubstitution(object): self._substitute_html_entity, s) - - class UnicodeDammit: """A class for detecting the encoding of a *ML document and converting it to a Unicode string. If the source encoding is -- cgit v1.2.3