Skip to content

Commit

Permalink
dont use len(x) > 1
Browse files Browse the repository at this point in the history
dont use len(x) < 1

use format str
  • Loading branch information
carlosp420 committed Sep 9, 2015
1 parent 927eb32 commit a30e1d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion voseq/core/forms.py
Expand Up @@ -61,6 +61,6 @@ def clean(self):
raise forms.ValidationError("You need to enter at least some "
"voucher codes or select a taxonset.")

if geneset is None and len(gene_codes) < 1:
if geneset is None and not gene_codes:
raise forms.ValidationError("You need to enter at least some "
"gene codes or select a geneset.")
4 changes: 2 additions & 2 deletions voseq/core/utils.py
Expand Up @@ -244,13 +244,13 @@ def translate_to_protein(gene_model, sequence, seq_description, seq_id, file_for
try:
prot_sequence = gapped_translation(seq_obj, gene_model['genetic_code'])
except TranslationError as e:
print("Error %s" % e)
print("Error {}".format(e))
return "", ""
else:
try:
prot_sequence = seq_obj.translate(table=gene_model['genetic_code'])
except TranslationError as e:
print("Error %s" % e)
print("Error {}".format(e))
return "", ""

if '*' in prot_sequence:
Expand Down
16 changes: 8 additions & 8 deletions voseq/public_interface/management/commands/_migrate_db.py
Expand Up @@ -140,7 +140,7 @@ def parse_table_genesets(self, xml_string):
break

if our_data is False:
raise ValueError("Could not find table %s in database dump file." % this_table)
raise ValueError("Could not find table {} in database dump file.".format(this_table))

self.table_genesets_items = []
for row in our_data.findall('row'):
Expand Down Expand Up @@ -184,7 +184,7 @@ def parse_table_members(self, xml_string):
break

if our_data is False:
raise ValueError("Could not find table %s in database dump file." % this_table)
raise ValueError("Could not find table {} in database dump file.".format(this_table))

self.table_members_items = []
for row in our_data.findall('row'):
Expand Down Expand Up @@ -231,7 +231,7 @@ def parse_table_primers(self, xml_string):
break

if our_data is False:
raise ValueError("Could not find table %s in database dump file." % this_table)
raise ValueError("Could not find table {} in database dump file.".format(this_table))

self.table_primers_items = []
for row in our_data.findall('row'):
Expand Down Expand Up @@ -298,7 +298,7 @@ def parse_table_sequences(self, xml_string):
break

if our_data is False:
raise ValueError("Could not find table %s in database dump file." % this_table)
raise ValueError("Could not find table {} in database dump file.".format(this_table))

self.table_sequences_items = []
for row in our_data.findall('row'):
Expand Down Expand Up @@ -400,7 +400,7 @@ def save_table_sequences_to_db(self):

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)))
print("ERROR: Couldn't insert {} sequences due to lack of reference vouchers".format(len(seqs_not_to_insert)))
for i in seqs_not_to_insert:
if self.verbosity != 0:
print(i['code_id'], i['gene_code'])
Expand All @@ -424,7 +424,7 @@ def parse_table_taxonsets(self, xml_string):
break

if our_data is False:
raise ValueError("Could not find table %s in database dump file." % this_table)
raise ValueError("Could not find table {} in database dump file.".format(this_table))

self.table_taxonsets_items = []
for row in our_data.findall('row'):
Expand Down Expand Up @@ -466,7 +466,7 @@ def parse_table_vouchers(self, xml_string):
break

if our_data is False:
raise ValueError("Could not find table %s in database dump file." % this_table)
raise ValueError("Could not find table {} in database dump file.".format(this_table))

self.table_vouchers_items = []
for row in our_data.findall('row'):
Expand Down Expand Up @@ -746,7 +746,7 @@ def parse_timestamp(self, timestamp, field):
date_obj = None

if self.verbosity != 0:
print("WARNING:: Could not parse %s properly." % field)
print("WARNING:: Could not parse {} properly.".format(field))
return date_obj


Expand Down

0 comments on commit a30e1d0

Please sign in to comment.