1
2
3 __author__ = "Abhinav Sarkar <abhinav@abhinavsarkar.net>"
4 __version__ = "0.2"
5 __license__ = "GNU Lesser General Public License"
8 """Base class for all the classes in this package"""
9
10 @staticmethod
12 def decorator(func):
13 def wrapper(ob):
14 top_list = getattr(ob, list_property_name)
15 return (len(top_list) and top_list[0] or None)
16 return property(fget = wrapper, doc = func.__doc__)
17 return decorator
18
19 @staticmethod
21 func_name = func.func_code.co_name
22 attribute_name = "_%s" % func_name
23
24 def wrapper(ob):
25 cache_attribute = getattr(ob, attribute_name, None)
26 if cache_attribute is None:
27 cache_attribute = func(ob)
28 setattr(ob, attribute_name, cache_attribute)
29 try:
30 cp = copy.copy(cache_attribute)
31 return cp
32 except LastfmError:
33 return cache_attribute
34
35 return property(fget = wrapper, doc = func.__doc__)
36
37 @staticmethod
53 return wrapper
54
56 return not (self.__lt__(other) or self.__eq(other))
57
59 return not self.__eq__(other)
60
62 return not self.__lt__(other)
63
65 return not self.__gt__(other)
66
67 import copy
68 from lastfm.error import LastfmError, AuthenticationFailedError
69