| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -15,7 +15,7 @@ from autobigs.engine.reading import read_fasta
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				from autobigs.engine.structures.alignment import PairwiseAlignment
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				from autobigs.engine.structures.genomics import NamedString
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				from autobigs.engine.structures.mlst import Allele, NamedMLSTProfile, AlignmentStats, MLSTProfile
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				from autobigs.engine.exceptions.database import NoBIGSdbExactMatchesException, NoBIGSdbMatchesException, NoSuchBIGSdbDatabaseException
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				from autobigs.engine.exceptions.database import BIGSdbResponseNotOkay, NoBIGSdbExactMatchesException, NoBIGSdbMatchesException, NoSuchBIGSdbDatabaseException
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				from Bio.Align import PairwiseAligner
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -43,13 +43,12 @@ class BIGSdbMLSTProfiler(AbstractAsyncContextManager):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				class RemoteBIGSdbMLSTProfiler(BIGSdbMLSTProfiler):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    def __init__(self, database_api: str, database_name: str, scheme_id: int, retry_requests: int = 5, timeout: int = 1800):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        self._timeout = timeout
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    def __init__(self, database_api: str, database_name: str, scheme_id: int, retry_requests: int = 5):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        self._retry_limit = retry_requests
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        self._database_name = database_name
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        self._scheme_id = scheme_id
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        self._base_url = f"{database_api}/db/{self._database_name}/schemes/{self._scheme_id}/"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        self._http_client = ClientSession(self._base_url, timeout=ClientTimeout(timeout))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        self._http_client = ClientSession(self._base_url, timeout=ClientTimeout(300))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    async def __aenter__(self):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return self
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -100,7 +99,10 @@ class RemoteBIGSdbMLSTProfiler(BIGSdbMLSTProfiler):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                )
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                yield result_allele if isinstance(sequence_string, str) else (sequence_string.name, result_allele)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        else:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            if response.status == 200:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                raise NoBIGSdbMatchesException(self._database_name, self._scheme_id, sequence_string.name if isinstance(sequence_string, NamedString) else None)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            else:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                raise BIGSdbResponseNotOkay(sequence_response)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                except (ConnectionError, ServerDisconnectedError, ClientOSError) as e: # Errors we will retry
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    last_error = e
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    success = False
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				 
 |