From 37d13b2a067ed8cc5cde1fd167ef5c55d61087cf Mon Sep 17 00:00:00 2001 From: kaliko Date: Fri, 1 Nov 2013 11:52:38 +0100 Subject: [PATCH] Fix generator expiration --- sima/plugins/lastfm.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sima/plugins/lastfm.py b/sima/plugins/lastfm.py index ec612ee..751b2c3 100644 --- a/sima/plugins/lastfm.py +++ b/sima/plugins/lastfm.py @@ -36,15 +36,17 @@ def cache(func): return wrapper def blacklist(artist=False, album=False, track=False): - field = (bl for bl in (artist, album, track)) + #pylint: disable=C0111,W0212 + field = (artist, album, track) def decorated(func): def wrapper(*args, **kwargs): cls = args[0] + boolgen = (bl for bl in field) bl_fun = (cls._Plugin__daemon.sdb.get_bl_artist, cls._Plugin__daemon.sdb.get_bl_album, cls._Plugin__daemon.sdb.get_bl_track,) - #bl_getter = next(fn for fn, bl in zip(bl_fun, field) if bl is True) - bl_getter = next(dropwhile(lambda _: not next(field), bl_fun)) + #bl_getter = next(fn for fn, bl in zip(bl_fun, boolgen) if bl is True) + bl_getter = next(dropwhile(lambda _: not next(boolgen), bl_fun)) results = func(*args, **kwargs) cls.log.debug('using {0} as bl filter'.format(bl_getter.__name__)) for elem in results: -- 2.39.5