summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-21 17:24:18 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-21 17:24:18 -0500
commita5b617e5f09af255783ad87acde0e7fbd6fb0cbe (patch)
tree82fdd84b1bcf8336e7d1d366f94afdb92ffcca4d
parentb321b7671e7a4ddc1f63e5257a6eabaf1abdf62c (diff)
Minor cleanup.
-rw-r--r--beautifulsoup/dammit.py14
1 files changed, 2 insertions, 12 deletions
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