Skip to content

Commit ae7e147

Browse files
jnothmanlarsmans
authored andcommitted
FIX out-of-core example had been broken
1 parent 3645354 commit ae7e147

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

examples/applications/plot_out_of_core_classification.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,18 @@ def _not_in_sphinx():
6464
class ReutersParser(html_parser.HTMLParser):
6565
"""Utility class to parse a SGML file and yield documents one at a time."""
6666

67-
def __init__(self, verbose=0, encoding='latin-1'):
68-
html_parser.HTMLParser.__init__(self, verbose)
67+
def __init__(self, encoding='latin-1'):
68+
html_parser.HTMLParser.__init__(self)
6969
self._reset()
7070
self.encoding = encoding
7171

72-
if not six.PY2:
73-
# In Python 3 need to be defined explicitly
74-
def handle_starttag(tag, attrs):
75-
method = 'start_' + tag
76-
getattr(self, method, lambda x: None)(attrs)
77-
self.handle_starttag = handle_starttag
78-
79-
def handle_endtag(tag):
80-
method = 'end_' + tag
81-
getattr(self, method, lambda: None)()
82-
self.handle_endtag = handle_endtag
72+
def handle_starttag(self, tag, attrs):
73+
method = 'start_' + tag
74+
getattr(self, method, lambda x: None)(attrs)
75+
76+
def handle_endtag(self, tag):
77+
method = 'end_' + tag
78+
getattr(self, method, lambda: None)()
8379

8480
def _reset(self):
8581
self.in_title = 0

0 commit comments

Comments
 (0)