Fixed potential memory leak

This commit is contained in:
Harrison Deng 2025-01-27 22:02:52 +00:00
parent 6d0157581f
commit ba1f0aa318

View File

@ -23,10 +23,11 @@ class BIGSdbMLSTProfiler(AbstractAsyncContextManager):
async def fetch_mlst_allele_variants(self, sequence_string: str, exact: bool) -> AsyncGenerator[Allele, Any]: async def fetch_mlst_allele_variants(self, sequence_string: str, exact: bool) -> AsyncGenerator[Allele, Any]:
# See https://bigsdb.pasteur.fr/api/db/pubmlst_bordetella_seqdef/schemes # See https://bigsdb.pasteur.fr/api/db/pubmlst_bordetella_seqdef/schemes
uri_path = "sequence" uri_path = "sequence"
response = await self._http_client.post(uri_path, json={
async with self._http_client.post(uri_path, json={
"sequence": sequence_string, "sequence": sequence_string,
"partial_matches": not exact "partial_matches": not exact
}) }) as response:
sequence_response: dict = await response.json() sequence_response: dict = await response.json()
if "exact_matches" in sequence_response: if "exact_matches" in sequence_response: