more filter->list(filter

This commit is contained in:
j 2017-02-25 11:41:48 +01:00
parent 67b2fd698b
commit b8f191b3c9
4 changed files with 7 additions and 7 deletions

View file

@ -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:

View file

@ -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)

View file

@ -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

View file

@ -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)