Skip to content

Commit

Permalink
minor code readability updates
Browse files Browse the repository at this point in the history
  • Loading branch information
JAlvarezJarreta committed Nov 20, 2018
1 parent c59363f commit 5a31711
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions MEvoLib/Fetch/BioSeqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

# Dictionary with the corresponding retrieval type of each Entrez
# database supported by BioSeqs class
entrez_db_dict = {'nuccore': 'gbwithparts', 'nucest': 'gb', 'nucgss': 'gb',
ENTREZ_DB_DICT = {'nuccore': 'gbwithparts', 'nucest': 'gb', 'nucgss': 'gb',
'popset': 'gb', 'protein': 'gp'}
# Constant that limits the maximum number of sequences that can be
# fetched
Expand All @@ -67,7 +67,7 @@
def _get_entrez_db_rettype (entrez_db):
"""
Check if the given entrez database is supported by the BioSeqs class.
Supported entrez databases are stored in 'entrez_db_dict'.
Supported entrez databases are stored in 'ENTREZ_DB_DICT'.
Arguments:
entrez_db (string)
Expand All @@ -81,8 +81,8 @@ def _get_entrez_db_rettype (entrez_db):
ValueError
If the introduced database is not supported.
"""
if (entrez_db in entrez_db_dict):
return (entrez_db_dict[entrez_db])
if (entrez_db in ENTREZ_DB_DICT):
return (ENTREZ_DB_DICT[entrez_db])
else:
message = '"{}" isn\'t a supported NCBI\'s Entrez DB'.format(entrez_db)
raise ValueError(message)
Expand Down Expand Up @@ -348,9 +348,9 @@ def from_entrez (cls, email, entrez_db, query, max_fetch = sys.maxsize):
# If it is the first time for this batch, wait for a
# minute to see if we can recover from the exception
if (not exceptRaised):
exceptRaised = True
warnings.warn(("Exception raised durig fetching. Trying"
"to recover..."))
exceptRaised = True
sleep(60)
else:
warnings.warn(("Exception raised for second time. "
Expand Down

0 comments on commit 5a31711

Please sign in to comment.