From: kaliko Date: Fri, 1 Nov 2013 10:52:38 +0000 (+0100) Subject: Fix generator expiration X-Git-Tag: mpd-sima/0.12.0pr2~36 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=37d13b2a067ed8cc5cde1fd167ef5c55d61087cf;p=mpd-sima.git Fix generator expiration --- 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: