From 2c9f699ffd2bd973ec288d8c7d2ec84ee97061db Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 21 Aug 2022 08:06:10 -0700 Subject: [PATCH 1/4] Use non-deprecated name for `notify_all` `notifyAll` was deprecated in: https://github.com/python/cpython/issues/87889 The new name, `notify_all`, has been available since Python 3.0. --- beets/util/pipeline.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beets/util/pipeline.py b/beets/util/pipeline.py index d338cb51b..f4cc23819 100644 --- a/beets/util/pipeline.py +++ b/beets/util/pipeline.py @@ -75,8 +75,8 @@ def _invalidate_queue(q, val=None, sync=True): q._qsize = _qsize q._put = _put q._get = _get - q.not_empty.notifyAll() - q.not_full.notifyAll() + q.not_empty.notify_all() + q.not_full.notify_all() finally: if sync: From 63b7595bd4c1a6b3af9b86d741765c903c1a4232 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 21 Aug 2022 08:13:07 -0700 Subject: [PATCH 2/4] Remove use of `imp` The replacements in `importlib.util` have been available since Python 3.5. --- test/test_player.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_player.py b/test/test_player.py index 9179fb2e1..7a4e85b17 100644 --- a/test/test_player.py +++ b/test/test_player.py @@ -35,8 +35,10 @@ import confuse # Mock GstPlayer so that the forked process doesn't attempt to import gi: from unittest import mock -import imp -gstplayer = imp.new_module("beetsplug.bpd.gstplayer") +import importlib.util +gstplayer = importlib.util.module_from_spec( + importlib.util.find_spec("beetsplug.bpd.gstplayer") +) def _gstplayer_play(*_): # noqa: 42 bpd.gstplayer._GstPlayer.playing = True return mock.DEFAULT From 8c84bae6891cbe62383be1c90e57566d42c18feb Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 21 Aug 2022 08:18:49 -0700 Subject: [PATCH 3/4] Remove `match_querystring` in `responses` Quoth the responses documentation: > querystring is matched by default Not sure how recent this is, unfortunately---but probably 0.17.0, since that's the version where `match_querystring` was deprecated. --- test/test_art.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test_art.py b/test/test_art.py index b32285e70..615682a53 100644 --- a/test/test_art.py +++ b/test/test_art.py @@ -336,8 +336,7 @@ class AAOTest(UseThePlugin): super().run(*args, **kwargs) def mock_response(self, url, body): - responses.add(responses.GET, url, body=body, content_type='text/html', - match_querystring=True) + responses.add(responses.GET, url, body=body, content_type='text/html') def test_aao_scraper_finds_image(self): body = """ From 8cb314350cb6d939c5c4e75b14762463f06651b7 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 21 Aug 2022 09:50:53 -0700 Subject: [PATCH 4/4] Avoid BeautifulSoup deprecation warning The `text` parameter to `SoupStrainer` was renamed to `string` in 2015 (4.4.0) and started producing a warning this year (4.11.0). https://bazaar.launchpad.net/%7Eleonardr/beautifulsoup/bs4/view/head:/CHANGELOG --- beetsplug/lyrics.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index 6e0439271..800e0302a 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -560,7 +560,8 @@ def scrape_lyrics_from_html(html): html = _scrape_merge_paragraphs(html) # extract all long text blocks that are not code - soup = try_parse_html(html, parse_only=SoupStrainer(text=is_text_notcode)) + soup = try_parse_html(html, + parse_only=SoupStrainer(string=is_text_notcode)) if not soup: return None