Skip to content
Snippets Groups Projects
Commit ae7e1472 authored by Joel Nothman's avatar Joel Nothman Committed by Lars Buitinck
Browse files

FIX out-of-core example had been broken

parent 36453542
Branches
Tags
No related merge requests found
......@@ -64,22 +64,18 @@ def _not_in_sphinx():
class ReutersParser(html_parser.HTMLParser):
"""Utility class to parse a SGML file and yield documents one at a time."""
def __init__(self, verbose=0, encoding='latin-1'):
html_parser.HTMLParser.__init__(self, verbose)
def __init__(self, encoding='latin-1'):
html_parser.HTMLParser.__init__(self)
self._reset()
self.encoding = encoding
if not six.PY2:
# In Python 3 need to be defined explicitly
def handle_starttag(tag, attrs):
def handle_starttag(self, tag, attrs):
method = 'start_' + tag
getattr(self, method, lambda x: None)(attrs)
self.handle_starttag = handle_starttag
def handle_endtag(tag):
def handle_endtag(self, tag):
method = 'end_' + tag
getattr(self, method, lambda: None)()
self.handle_endtag = handle_endtag
def _reset(self):
self.in_title = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment