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