From 158273e0ae9bd6ab2443269feb7265dff2efc0d0 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 22 Jun 2020 22:20:29 +0300 Subject: [PATCH 1/2] Deprecate Artist.get_cover_image, they're no longer available from Last.fm --- src/pylast/__init__.py | 9 +++++++++ tests/test_artist.py | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pylast/__init__.py b/src/pylast/__init__.py index 21e21404..fb2de228 100644 --- a/src/pylast/__init__.py +++ b/src/pylast/__init__.py @@ -1726,6 +1726,15 @@ def get_cover_image(self, size=SIZE_EXTRA_LARGE): SIZE_SMALL """ + warnings.warn( + "Artist.get_cover_image is deprecated and will be removed in a future " + "version. In the meantime, only default star images are available. " + "See https://github.com/pylast/pylast/issues/317 and " + "https://support.last.fm/t/api-announcement/202", + DeprecationWarning, + stacklevel=2, + ) + if "image" not in self.info: self.info["image"] = _extract_all( self._request(self.ws_prefix + ".getInfo", cacheable=True), "image" diff --git a/tests/test_artist.py b/tests/test_artist.py index aa3e0075..435db955 100755 --- a/tests/test_artist.py +++ b/tests/test_artist.py @@ -250,7 +250,10 @@ def test_artists(self): # Act url = artist1.get_url() mbid = artist1.get_mbid() - image = artist1.get_cover_image() + + with pytest.warns(DeprecationWarning): + image = artist1.get_cover_image() + playcount = artist1.get_playcount() streamable = artist1.is_streamable() name = artist1.get_name(properly_capitalized=False) From e188e78bddd686dd0197e7071c9ff7da8b41c7a8 Mon Sep 17 00:00:00 2001 From: Hugo Date: Tue, 23 Jun 2020 11:21:40 +0300 Subject: [PATCH 2/2] pre-commit autoupdate, show diff on failure, and force colour on GHA --- .pre-commit-config.yaml | 6 +++--- tox.ini | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8461ec42..da1e286d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.4.4 + rev: v2.6.1 hooks: - id: pyupgrade args: ["--py3-plus"] @@ -15,13 +15,13 @@ repos: types: [] - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.2 + rev: 3.8.3 hooks: - id: flake8 additional_dependencies: [flake8-2020, flake8-implicit-str-concat] - repo: https://github.com/asottile/seed-isort-config - rev: v2.1.1 + rev: v2.2.0 hooks: - id: seed-isort-config diff --git a/tox.ini b/tox.ini index f6e43d78..ecb5bd75 100644 --- a/tox.ini +++ b/tox.ini @@ -16,5 +16,6 @@ commands = {posargs} [testenv:lint] deps = pre-commit -commands = pre-commit run --all-files +commands = pre-commit run --all-files --show-diff-on-failure skip_install = true +passenv = PRE_COMMIT_COLOR