Scrapy, a fast high-level web crawling & scraping framework for Python.
FixedSGMLParser is useless.
Mikhail Korobov7316a37635cc
diff --git a/scrapy/contrib/linkextractors/sgml.py b/scrapy/contrib/linkextractors/sgml.pyindex 520fc0c4b..71e16581e 100644--- a/scrapy/contrib/linkextractors/sgml.py+++ b/scrapy/contrib/linkextractors/sgml.py@@ -3,18 +3,19 @@ SGMLParser-based Link extractors"""from urlparse import urljoinimport warnings+from sgmllib import SGMLParserfrom w3lib.url import safe_url_stringfrom scrapy.selector import Selectorfrom scrapy.link import Linkfrom scrapy.linkextractor import FilteringLinkExtractorfrom scrapy.utils.misc import arg_to_iter-from scrapy.utils.python import FixedSGMLParser, unique as unique_list, str_to_unicode+from scrapy.utils.python import unique as unique_list, str_to_unicodefrom scrapy.utils.response import get_base_urlfrom scrapy.exceptions import ScrapyDeprecationWarning-class BaseSgmlLinkExtractor(FixedSGMLParser):+class BaseSgmlLinkExtractor(SGMLParser):def __init__(self, tag="a", attr="href", unique=False, process_value=None):warnings.warn(@@ -22,8 +23,7 @@ class BaseSgmlLinkExtractor(FixedSGMLParser):"Please use scrapy.contrib.linkextractors.LinkExtractor",ScrapyDeprecationWarning)- with warnings.catch_warnings(record=True):- FixedSGMLParser.__init__(self)+ SGMLParser.__init__(self)self.scan_tag = tag if callable(tag) else lambda t: t == tagself.scan_attr = attr if callable(attr) else lambda a: a == attrself.process_value = (lambda v: v) if process_value is None else process_value@@ -64,7 +64,7 @@ class BaseSgmlLinkExtractor(FixedSGMLParser):return linksdef reset(self):- FixedSGMLParser.reset(self)+ SGMLParser.reset(self)self.links = []self.base_url = Nonediff --git a/scrapy/utils/python.py b/scrapy/utils/python.pyindex db88a4e55..8c186fa8a 100644--- a/scrapy/utils/python.py+++ b/scrapy/utils/python.py@@ -22,12 +22,10 @@ if six.PY2:from sgmllib import SGMLParserclass FixedSGMLParser(SGMLParser):- """The SGMLParser that comes with Python has a bug in the convert_charref()- method. This is the same class with the bug fixed.-- Warning: this class is deprecated and will be removed in future releases."""-+ Warning: this class is deprecated and will be removed in future+ releases. Please use standard `sgmllib.SGMLParser`.+ """def __init__(self, *args, **kwargs):warnings.warn("FixedSGMLParser is deprecated and will be removed in future releases.",@@ -35,16 +33,6 @@ if six.PY2:)SGMLParser.__init__(self, *args, **kwargs)- def convert_charref(self, name):- """This method fixes a bug in Python's SGMLParser."""- try:- n = int(name)- except ValueError:- return- if not 0 <= n <= 127 : # ASCII ends at 127, not 255- return- return self.convert_codepoint(n)-def flatten(x):"""flatten(sequence) -> list