add space and other flake8 cleanups
This commit is contained in:
parent
225259e521
commit
5e149a5cb8
1 changed files with 24 additions and 24 deletions
|
@ -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
|
||||
|
||||
|
@ -164,7 +164,7 @@ class Edit(models.Model):
|
|||
elif self.status == 'featured' and value == 'public':
|
||||
Position.objects.filter(edit=self).delete()
|
||||
pos, created = Position.objects.get_or_create(edit=self,
|
||||
user=self.user,section='personal')
|
||||
user=self.user, section='personal')
|
||||
qs = Position.objects.filter(user=self.user,
|
||||
section='personal')
|
||||
pos.position = qs.aggregate(Max('position'))['position__max'] + 1
|
||||
|
@ -183,7 +183,7 @@ class Edit(models.Model):
|
|||
data['name'] = "Untitled"
|
||||
name = data['name']
|
||||
num = 1
|
||||
while Edit.objects.filter(name=name, user=self.user).exclude(id=self.id).count()>0:
|
||||
while Edit.objects.filter(name=name, user=self.user).exclude(id=self.id).count() > 0:
|
||||
num += 1
|
||||
name = data['name'] + ' [%d]' % num
|
||||
self.name = name
|
||||
|
@ -335,7 +335,7 @@ class Edit(models.Model):
|
|||
|
||||
def json(self, keys=None, user=None):
|
||||
if not keys:
|
||||
keys=[
|
||||
keys = [
|
||||
'clips',
|
||||
'description',
|
||||
'duration',
|
||||
|
@ -389,7 +389,7 @@ class Edit(models.Model):
|
|||
if user and not user.is_anonymous():
|
||||
response[key] = self.subscribed_users.filter(id=user.id).exists()
|
||||
elif hasattr(self, _map.get(key, key)):
|
||||
response[key] = getattr(self, _map.get(key,key))
|
||||
response[key] = getattr(self, _map.get(key, key))
|
||||
return response
|
||||
|
||||
def render(self):
|
||||
|
@ -426,8 +426,8 @@ class Clip(models.Model):
|
|||
duration = models.FloatField(default=0)
|
||||
|
||||
hue = models.FloatField(default=0)
|
||||
saturation= models.FloatField(default=0)
|
||||
lightness= models.FloatField(default=0)
|
||||
saturation = models.FloatField(default=0)
|
||||
lightness = models.FloatField(default=0)
|
||||
volume = models.FloatField(default=0)
|
||||
sortvalue = models.CharField(max_length=1000, null=True, db_index=True)
|
||||
|
||||
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue