From b8f191b3c9e8330608431c4c2ed5941313a96816 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 25 Feb 2017 11:41:48 +0100 Subject: [PATCH] more filter->list(filter --- pandora/archive/extract.py | 6 +++--- pandora/clip/models.py | 2 +- pandora/event/models.py | 4 ++-- pandora/item/models.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pandora/archive/extract.py b/pandora/archive/extract.py index 26c211cde..fa7e2577a 100644 --- a/pandora/archive/extract.py +++ b/pandora/archive/extract.py @@ -254,7 +254,7 @@ def stream(video, target, profile, info, audio_track=0, flags={}): audio_settings = [] # mix 2 mono channels into stereo(common for fcp dv mov files) if audio_track == 0 and len(info['audio']) == 2 \ - and len(filter(None, [a['channels'] == 1 or None for a in info['audio']])) == 2: + and len(list(filter(None, [a['channels'] == 1 or None for a in info['audio']]))) == 2: audio_settings += [ '-filter_complex', '[0:%s][0:%s] amerge' % (info['audio'][0]['id'], info['audio'][1]['id']) @@ -482,8 +482,8 @@ def average_color(prefix, start=0, end=0, mode='antialias'): start = int(start * 25) end = int(end * 25) mode = 'timeline' + mode - timelines = ox.sorted_strings(filter(lambda t: t != '%s%s%sp.jpg' % (prefix, mode, height), - glob("%s%s%sp*.jpg" % (prefix, mode, height)))) + timelines = ox.sorted_strings(list(filter(lambda t: t != '%s%s%sp.jpg' % (prefix, mode, height), + glob("%s%s%sp*.jpg" % (prefix, mode, height))))) for image in timelines: start_offset = 0 if start and frames + 1500 <= start: diff --git a/pandora/clip/models.py b/pandora/clip/models.py index 2e5eda47d..54e27be83 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -88,7 +88,7 @@ class MetaClip(object): else: self.sortvalue = None - self.findvalue = '\n'.join(filter(None, [a.findvalue for a in anns])) + self.findvalue = '\n'.join(list(filter(None, [a.findvalue for a in anns]))) for l in [k['id'] for k in settings.CONFIG['layers']]: setattr(self, l, l in anns_by_layer and len(anns_by_layer[l])) models.Model.save(self, *args, **kwargs) diff --git a/pandora/event/models.py b/pandora/event/models.py index 4ad7a9b1c..7fb74244c 100644 --- a/pandora/event/models.py +++ b/pandora/event/models.py @@ -132,8 +132,8 @@ class Event(models.Model): self.set_name_sort() self.name_find = '||' + '||'.join((self.name,) + self.alternativeNames) + '||' self.name_find = self.name_find.lower() - self.defined = len(filter(None, [getattr(self, key) - for key in ('start', 'end')])) > 0 + self.defined = len(list(filter(None, [getattr(self, key) + for key in ('start', 'end')]))) > 0 if self.endTime and self.startTime: self.durationTime = self.endTime - self.startTime diff --git a/pandora/item/models.py b/pandora/item/models.py index a37fad91a..f4f897477 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -806,7 +806,7 @@ class Item(models.Model): qs = Annotation.objects.filter(item=self).exclude(findvalue=None) qs = qs.filter(layer=i) qs = qs.order_by('start') - save(i, u'\n'.join(filter(None, [l.findvalue for l in qs]))) + save(i, u'\n'.join(list(filter(None, [l.findvalue for l in qs])))) layer_keys.append(i) elif i != '*' and i not in self.facet_keys: value = self.get(i)