Skip to content

Commit 3ac5632

Browse files
committed
Corrects some things were 2to3 did to much.
1 parent aa4132f commit 3ac5632

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

readability/htmls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def normalize_entities(cur_title):
3636
u'\u00BB': '"',
3737
u'"': '"',
3838
}
39-
for c, r in list(entities.items()):
39+
for c, r in entities.items():
4040
if c in cur_title:
4141
cur_title = cur_title.replace(c, r)
4242

readability/readability.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def compile_pattern(elements):
8989
else:
9090
# assume string or string like object
9191
elements = elements.split(',')
92-
return re.compile('|'.join([re.escape(x.lower()) for x in elements]), re.U)
92+
return re.compile(u'|'.join([re.escape(x.lower()) for x in elements]), re.U)
9393

9494
class Document:
9595
"""Class to build a etree document out of html."""
@@ -207,7 +207,7 @@ def summary(self, html_partial=False):
207207
# code never runs) which would require write this line as:
208208
# write this line as
209209
# Unparseable(str(e))
210-
# but then we loose the traceback information. 3.4 on the
210+
# but then we lose the traceback information. 3.4 on the
211211
# other hand accepts the old syntax and would only complain
212212
# at runtime.
213213
raise Unparseable(str(e)), None, sys.exc_info()[2]
@@ -262,7 +262,7 @@ def get_article(self, candidates, best_candidate, html_partial=False):
262262
return output
263263

264264
def select_best_candidate(self, candidates):
265-
sorted_candidates = sorted(list(candidates.values()), key=lambda x: x['content_score'], reverse=True)
265+
sorted_candidates = sorted(candidates.values(), key=lambda x: x['content_score'], reverse=True)
266266
for candidate in sorted_candidates[:5]:
267267
elem = candidate['elem']
268268
self.debug("Top 5 : %6.3f %s" % (

0 commit comments

Comments
 (0)