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