From 5ede29b401b7bd639f3e4dffd3e75ed9e73c28e8 Mon Sep 17 00:00:00 2001 From: Jesse Mullan Date: Sat, 1 Nov 2014 16:20:43 -0700 Subject: [PATCH] Fix W601 .has_key() is deprecated --- headphones/helpers.py | 2 +- headphones/lyrics.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/headphones/helpers.py b/headphones/helpers.py index ce29deef..e1fc3045 100644 --- a/headphones/helpers.py +++ b/headphones/helpers.py @@ -94,7 +94,7 @@ def latinToAscii(unicrap): r = '' for i in unicrap: - if xlate.has_key(ord(i)): + if ord(i) in xlate: r += xlate[ord(i)] elif ord(i) >= 0x80: pass diff --git a/headphones/lyrics.py b/headphones/lyrics.py index ea6fcd8f..2968725c 100644 --- a/headphones/lyrics.py +++ b/headphones/lyrics.py @@ -81,7 +81,7 @@ def convert_html_entities(s): hits.remove(amp) for hit in hits: name = hit[1:-1] - if htmlentitydefs.name2codepoint.has_key(name): - s = s.replace(hit, unichr(htmlentitydefs.name2codepoint[name])) + if name in htmlentitydefs.name2codepoint: + s = s.replace(hit, unichr(htmlentitydefs.name2codepoint[name])) s = s.replace(amp, "&") return s