From 5a317110b5b0857fffa375d339eba5d7c40ef8b9 Mon Sep 17 00:00:00 2001 From: JAlvarezJarreta Date: Tue, 20 Nov 2018 15:39:25 +0000 Subject: [PATCH] minor code readability updates --- MEvoLib/Fetch/BioSeqs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MEvoLib/Fetch/BioSeqs.py b/MEvoLib/Fetch/BioSeqs.py index 4268037..77d4281 100644 --- a/MEvoLib/Fetch/BioSeqs.py +++ b/MEvoLib/Fetch/BioSeqs.py @@ -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 @@ -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) @@ -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) @@ -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. "