add space and other flake8 cleanups

This commit is contained in:
j 2016-05-28 11:26:46 +02:00
parent 225259e521
commit 5e149a5cb8

View file

@ -71,7 +71,7 @@ class Edit(models.Model):
return ('/edits/%s' % quote(self.get_id())).replace('%3A', ':')
def add_clip(self, data, index=None):
if index != None:
if index is not None:
ids = [i['id'] for i in self.clips.order_by('index').values('id')]
c = Clip(edit=self)
if 'annotation' in data and data['annotation']:
@ -83,7 +83,7 @@ class Edit(models.Model):
c.end = data['out']
else:
return False
if index != None:
if index is not None:
c.index = index
# dont add clip if in/out are invalid
if not c.annotation:
@ -93,7 +93,7 @@ class Edit(models.Model):
or round(c.end, 3) > round(duration, 3):
return False
c.save()
if index != None:
if index is not None:
ids.insert(index, c.id)
self.sort_clips(ids)
return c
@ -131,7 +131,7 @@ class Edit(models.Model):
return False
if self.user == user or \
user.is_staff or \
user.profile.capability('canEditFeaturedEdits') == True:
user.profile.capability('canEditFeaturedEdits'):
return True
return False
@ -447,9 +447,9 @@ class Clip(models.Model):
sortvalue = ''
if self.id:
for l in settings.CONFIG.get('clipLayers', []):
sortvalue += ''.join(filter(lambda s: s,
[a.sortvalue
for a in self.get_annotations().filter(layer=l)]))
sortvalue += ''.join([a.sortvalue
for a in self.get_annotations().filter(layer=l)
if a.sortvalue])
if sortvalue:
self.sortvalue = sortvalue[:900]
else: