Skip to content

Commit

Permalink
avoid using len(x) to check if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosp420 committed Sep 4, 2015
1 parent 5b5be99 commit 2d7f5fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion voseq/public_interface/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def search(self):
sqs = SearchQuerySet().using('vouchers').filter(**keywords)
print(sqs)

if len(sqs) > 0:
if sqs:
return sqs
else:
self.no_query_found()
Expand Down
2 changes: 1 addition & 1 deletion voseq/public_interface/management/commands/_migrate_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def save_table_sequences_to_db(self):
print("Uploading table `public_interface_sequences`")
Sequences.objects.bulk_create(seqs_objects)

if len(seqs_not_to_insert) > 0:
if seqs_not_to_insert:
if self.verbosity != 0:
print("ERROR: Couldn't insert %i sequences due to lack of reference vouchers".format(len(seqs_not_to_insert)))
for i in seqs_not_to_insert:
Expand Down
6 changes: 3 additions & 3 deletions voseq/view_genes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def gene(request, gene_code):
username = get_username(request)

queryset = Genes.objects.filter(gene_code=gene_code)
if len(queryset) < 1:
item = ''
else:
if queryset:
item = queryset[0]
else:
item = ''

if ';' in item.intron:
introns = item.intron.split(';')
Expand Down

0 comments on commit 2d7f5fc

Please sign in to comment.