From 0cc4f92351a6e60afb9e676080af065dc347692e Mon Sep 17 00:00:00 2001 From: tehkillerbee Date: Mon, 8 Apr 2024 21:47:29 +0200 Subject: [PATCH] Use built-in function python depreciation. Apply formatting --- tidalapi/artist.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tidalapi/artist.py b/tidalapi/artist.py index da2d881..b2808c4 100644 --- a/tidalapi/artist.py +++ b/tidalapi/artist.py @@ -22,6 +22,7 @@ from datetime import datetime from enum import Enum from typing import TYPE_CHECKING, List, Mapping, Optional, Union, cast +from warnings import warn import dateutil.parser from typing_extensions import NoReturn @@ -126,9 +127,13 @@ def get_albums(self, limit: Optional[int] = None, offset: int = 0) -> List["Albu return self._get_albums(params) def get_albums_ep_singles( - self, limit: Optional[int] = None, offset: int = 0 + self, limit: Optional[int] = None, offset: int = 0 ) -> List["Album"]: - print("This method is deprecated an will be removed in a future release. Use instead `get_ep_singles`") + warn( + "This method is deprecated an will be removed in a future release. Use instead `get_ep_singles`", + DeprecationWarning, + stacklevel=2, + ) return self.get_ep_singles(limit=limit, offset=offset) @@ -143,15 +148,17 @@ def get_ep_singles( return self._get_albums(params) def get_albums_other( - self, limit: Optional[int] = None, offset: int = 0 + self, limit: Optional[int] = None, offset: int = 0 ) -> List["Album"]: - print("This method is deprecated an will be removed in a future release. Use instead `get_other`") + warn( + "This method is deprecated an will be removed in a future release. Use instead `get_other`", + DeprecationWarning, + stacklevel=2, + ) return self.get_other(limit=limit, offset=offset) - def get_other( - self, limit: Optional[int] = None, offset: int = 0 - ) -> List["Album"]: + def get_other(self, limit: Optional[int] = None, offset: int = 0) -> List["Album"]: """Queries TIDAL for albums the artist has appeared on as a featured artist. :return: A list of :class:`Albums `