Skip to content

Commit

Permalink
fix "is False", "is True"
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosp420 committed Nov 13, 2015
1 parent a56bb74 commit 4f24d03
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 30 deletions.
4 changes: 2 additions & 2 deletions voseq/blast_local/utils.py
Expand Up @@ -79,7 +79,7 @@ def is_blast_db_up_to_date(self):
:return: True or False
"""
if self.have_blast_db() is False:
if not self.have_blast_db():
return False

# get time creation blast database files
Expand Down Expand Up @@ -132,7 +132,7 @@ def create_blast_db(self):
"""
print("Creating blast db")
if self.mask is True:
if self.mask:
command = 'dustmasker -in ' + self.seq_file + ' -infmt fasta '
command += '-outfmt maskinfo_asn1_bin -out ' + self.seq_file + '_dust.asnb'
subprocess.check_output(command, shell=True) # identifying low-complexity regions.
Expand Down
2 changes: 1 addition & 1 deletion voseq/blast_local/views.py
Expand Up @@ -12,7 +12,7 @@ def index(request, voucher_code, gene_code):
blast = BLAST('local', voucher_code, gene_code)
blast.save_seqs_to_file()

if blast.is_blast_db_up_to_date() is False:
if not blast.is_blast_db_up_to_date():
blast.create_blast_db()

blast.save_query_to_file()
Expand Down
2 changes: 1 addition & 1 deletion voseq/blast_local_full/views.py
Expand Up @@ -12,7 +12,7 @@ def index(request, voucher_code, gene_code):
blast = BLASTFull('full', voucher_code, gene_code)
blast.save_seqs_to_file()

if blast.is_blast_db_up_to_date() is False:
if not blast.is_blast_db_up_to_date():
blast.create_blast_db()

blast.save_query_to_file()
Expand Down
2 changes: 1 addition & 1 deletion voseq/blast_new/views.py
Expand Up @@ -36,7 +36,7 @@ def results(request):
cleaned_data['gene_codes'])
blast.save_seqs_to_file()

if blast.is_blast_db_up_to_date() is False:
if not blast.is_blast_db_up_to_date():
blast.create_blast_db()

blast.save_query_to_file()
Expand Down
6 changes: 3 additions & 3 deletions voseq/create_dataset/utils.py
Expand Up @@ -65,11 +65,11 @@ def __init__(self, cleaned_data):
self.dataset_str = self.create_dataset()

def clean_translations(self):
if self.cleaned_data['translations'] is False:
if self.cleaned_data['translations']:
self.degen_translations = self.cleaned_data['degen_translations']
else:
# No need to do degen translation
self.degen_translations = None
else:
self.degen_translations = self.cleaned_data['degen_translations']

def create_dataset(self):
if not self.codon_positions:
Expand Down
5 changes: 2 additions & 3 deletions voseq/public_interface/forms.py
Expand Up @@ -140,11 +140,10 @@ def no_query_found(self):
def search(self):
keywords, sequence_keywords = self.clean_search_keywords()
sqs = ''
if bool(sequence_keywords) is True:
if sequence_keywords:
sqs = SearchQuerySet().using('advanced_search').filter(**sequence_keywords).facet('code')
sqs = filter_results_from_sequence_table(sqs)
if bool(keywords) is True:
print(keywords)
if keywords:
if sqs != '':
sqs = sqs.filter(**keywords)
else:
Expand Down
38 changes: 19 additions & 19 deletions voseq/public_interface/management/commands/_migrate_db.py
Expand Up @@ -29,7 +29,7 @@

TZINFO = pytz.utc

if settings.TESTING is True:
if settings.TESTING:
TESTING = True
else:
TESTING = False
Expand Down Expand Up @@ -73,7 +73,7 @@ def parse_image_info(self, item):
item['thumbnail'] = self.get_as_tuple(item['thumbnail'], got_flickr)

imgs = []
if got_flickr is True and item['flickr_id']:
if got_flickr and item['flickr_id']:
item['flickr_id'] = self.get_as_tuple(item['flickr_id'], got_flickr)

for i in range(0, len(item['voucher_image']), 1):
Expand Down Expand Up @@ -102,7 +102,7 @@ def parse_table_genes(self, xml_string):
our_data = i
break

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

self.table_genes_items = []
Expand Down Expand Up @@ -131,7 +131,7 @@ def parse_table_genesets(self, xml_string):
our_data = i
break

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

self.table_genesets_items = []
Expand All @@ -157,7 +157,7 @@ def parse_table_members(self, xml_string):
our_data = i
break

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

self.table_members_items = []
Expand Down Expand Up @@ -187,7 +187,7 @@ def parse_table_primers(self, xml_string):
our_data = i
break

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

self.table_primers_items = []
Expand Down Expand Up @@ -221,7 +221,7 @@ def parse_table_sequences(self, xml_string):
our_data = i
break

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

self.table_sequences_items = []
Expand All @@ -248,7 +248,7 @@ def parse_table_taxonsets(self, xml_string):
our_data = i
break

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

self.table_taxonsets_items = []
Expand All @@ -271,7 +271,7 @@ def parse_table_vouchers(self, xml_string):
our_data = i
break

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

self.table_vouchers_items = []
Expand Down Expand Up @@ -491,10 +491,10 @@ def save_table_members_to_db(self):
user = User.objects.create_user(item['username'], email=None, first_name=item['first_name'],
last_name=item['last_name'])
user.is_staff = True
if item['is_superuser'] is False:
user.is_superuser = False
else:
if item['is_superuser']:
user.is_superuser = True
else:
user.is_superuser = False
user.save()

if not TESTING:
Expand Down Expand Up @@ -535,7 +535,7 @@ def save_table_sequences_to_db(self):
seqs_invalid = []
for i in self.table_sequences_items:
validation = validate_sequence(i['sequences'])
if validation.is_valid is False:
if not validation.is_valid:
ProblematicSequence = namedtuple('ProblematicSequence',
['code', 'gene_code', 'invalid_character'])
prob_seq = ProblematicSequence(i['code_id'], i['gene_code'], validation.invalid_character)
Expand All @@ -551,7 +551,7 @@ def save_table_sequences_to_db(self):
print("\nUploading table `public_interface_sequences`")

n = len(seqs_to_insert)
if TESTING is False:
if not TESTING:
bar = pyprind.ProgBar(n, width=70)

seqs_objects = []
Expand All @@ -565,7 +565,7 @@ def save_table_sequences_to_db(self):
item = self.clean_value(item, 'sequences')
item = self.clean_value(item, 'accession')
seqs_objects.append(Sequences(**item))
if TESTING is False:
if not TESTING:
bar.update()

if not TESTING:
Expand Down Expand Up @@ -611,7 +611,7 @@ def save_table_vouchers_to_db(self):

voucher_objs = []
n = len(self.table_vouchers_items)
if TESTING is False:
if not TESTING:
bar = pyprind.ProgBar(n, width=70)
for i in range(n):
item = self.table_vouchers_items[i]
Expand Down Expand Up @@ -645,7 +645,7 @@ def save_table_vouchers_to_db(self):

voucher_objs.append(Vouchers(**item))

if TESTING is False:
if not TESTING:
bar.update()
Vouchers.objects.bulk_create(voucher_objs)

Expand Down Expand Up @@ -689,10 +689,10 @@ def get_as_tuple(self, string, got_flickr=None):
return as_tupple

def strip_domain_from_filename(self, item, got_flickr=None):
if got_flickr is False:
if not got_flickr:
disassembled = parse.urlsplit(item)
return basename(disassembled.path)
elif got_flickr is True:
elif got_flickr:
return item
else:
return None
Expand Down

0 comments on commit 4f24d03

Please sign in to comment.