From 454c519fd9b1494c51606f826057b72dd8b8de70 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 25 Sep 2017 18:29:12 +0300 Subject: [PATCH] Remove dead Last.fm group methods --- pylast/__init__.py | 86 ++------------------------------------------ tests/test_pylast.py | 23 ------------ 2 files changed, 3 insertions(+), 106 deletions(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index f0436d1..fe9b0bf 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -241,13 +241,6 @@ class _Network(object): return Metro(metro_name, country_name, self) - def get_group(self, name): - """ - Returns a Group object - """ - - return Group(name, self) - def get_user(self, username): """ Returns a user object @@ -766,7 +759,6 @@ class LastFMNetwork(_Network): "country": "place/%(country_name)s", "tag": "tag/%(name)s", "track": "music/%(artist)s/_/%(title)s", - "group": "group/%(name)s", "user": "user/%(name)s", } ) @@ -830,7 +822,6 @@ class LibreFMNetwork(_Network): "country": "place/%(country_name)s", "tag": "tag/%(name)s", "track": "music/%(artist)s/_/%(title)s", - "group": "group/%(name)s", "user": "user/%(name)s", } ) @@ -1288,7 +1279,7 @@ class _Chartable(object): """ Returns the weekly album charts for the week starting from the from_date value to the to_date value. - Only for Group or User. + Only for User. """ return self.get_weekly_charts("album", from_date, to_date) @@ -1296,7 +1287,7 @@ class _Chartable(object): """ Returns the weekly artist charts for the week starting from the from_date value to the to_date value. - Only for Group, Tag or User. + Only for Tag or User. """ return self.get_weekly_charts("artist", from_date, to_date) @@ -1304,7 +1295,7 @@ class _Chartable(object): """ Returns the weekly track charts for the week starting from the from_date value to the to_date value. - Only for Group or User. + Only for User. """ return self.get_weekly_charts("track", from_date, to_date) @@ -2580,77 +2571,6 @@ class Track(_Opus): 'artist': artist, 'title': title} -class Group(_BaseObject, _Chartable): - """A Last.fm group.""" - - name = None - - __hash__ = _BaseObject.__hash__ - - def __init__(self, name, network): - _BaseObject.__init__(self, network, 'group') - _Chartable.__init__(self, 'group') - - self.name = name - - def __repr__(self): - return "pylast.Group(%s, %s)" % (repr(self.name), repr(self.network)) - - @_string_output - def __str__(self): - return self.get_name() - - def __eq__(self, other): - return self.get_name().lower() == other.get_name().lower() - - def __ne__(self, other): - return self.get_name() != other.get_name() - - def _get_params(self): - return {self.ws_prefix: self.get_name()} - - def get_name(self): - """Returns the group name. """ - return self.name - - def get_url(self, domain_name=DOMAIN_ENGLISH): - """Returns the url of the group page on the network. - * domain_name: The network's language domain. Possible values: - o DOMAIN_ENGLISH - o DOMAIN_GERMAN - o DOMAIN_SPANISH - o DOMAIN_FRENCH - o DOMAIN_ITALIAN - o DOMAIN_POLISH - o DOMAIN_PORTUGUESE - o DOMAIN_SWEDISH - o DOMAIN_TURKISH - o DOMAIN_RUSSIAN - o DOMAIN_JAPANESE - o DOMAIN_CHINESE - """ - - name = _url_safe(self.get_name()) - - return self.network._get_url(domain_name, "group") % {'name': name} - - def get_members(self, limit=50, cacheable=False): - """ - Returns a sequence of User objects - if limit==None it will return all - """ - - nodes = _collect_nodes( - limit, self, self.ws_prefix + ".getMembers", cacheable) - - users = [] - - for node in nodes: - users.append(User(_extract(node, "name"), self.network)) - - return users - - class User(_BaseObject, _Chartable): """A Last.fm user.""" diff --git a/tests/test_pylast.py b/tests/test_pylast.py index 717c1be..0146174 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -287,13 +287,6 @@ class TestPyLast(unittest.TestCase): # Act/Assert self.helper_is_thing_hashable(event) - def test_group_is_hashable(self): - # Arrange - group = self.network.get_group("Audioscrobbler Beta") - - # Act/Assert - self.helper_is_thing_hashable(group) - def test_library_is_hashable(self): # Arrange library = pylast.Library(user=self.username, network=self.network) @@ -639,13 +632,6 @@ class TestPyLast(unittest.TestCase): # Assert self.helper_validate_results(result1, result2, result3) - def test_cacheable_group_get_members(self): - # Arrange - group = self.network.get_group("Audioscrobbler Beta") - - # Act/Assert - self.helper_validate_cacheable(group, "get_members") - def test_cacheable_library(self): # Arrange library = pylast.Library(self.username, self.network) @@ -987,15 +973,6 @@ class TestPyLast(unittest.TestCase): self.helper_assert_chart(album_chart, pylast.Album) self.helper_assert_chart(track_chart, pylast.Track) - def test_group_charts(self): - # Arrange - group = self.network.get_group("mnml") - dates = group.get_weekly_chart_dates() - self.helper_dates_valid(dates) - - # Act/Assert - self.helper_get_assert_charts(group, dates[-2]) - def test_tag_charts(self): # Arrange tag = self.network.get_tag("rock")