From 42d4b95fce2ef8a76b70c7f9130a8b470b77d463 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Mon, 13 Jan 2025 13:57:53 -0500 Subject: [PATCH] move the new check later b/c earlier steps should still work --- astroquery/linelists/cdms/core.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/astroquery/linelists/cdms/core.py b/astroquery/linelists/cdms/core.py index c0ef13c740..51074f3142 100644 --- a/astroquery/linelists/cdms/core.py +++ b/astroquery/linelists/cdms/core.py @@ -145,13 +145,6 @@ def query_lines_async(self, min_frequency, max_frequency, *, else: payload['Molecules'] = molecule - # accounts for three formats, e.g.: '058501' or 'H2C2S' or '058501 H2C2S' - badlist = (self.MALFORMATTED_MOLECULE_LIST + # noqa - [y for x in self.MALFORMATTED_MOLECULE_LIST for y in x.split()]) - if payload['Molecules'] in badlist: - raise ValueError(f"Molecule {payload['Molecules']} is known not to comply with standard CDMS format. " - f"Try get_molecule({payload['Molecules']}) instead.") - payload = list(payload.items()) if get_query_payload: @@ -179,6 +172,13 @@ def query_lines_async(self, min_frequency, max_frequency, *, response2 = self._request(method='GET', url=fullurl, timeout=self.TIMEOUT, cache=cache) + # accounts for three formats, e.g.: '058501' or 'H2C2S' or '058501 H2C2S' + badlist = (self.MALFORMATTED_MOLECULE_LIST + # noqa + [y for x in self.MALFORMATTED_MOLECULE_LIST for y in x.split()]) + if payload['Molecules'] in badlist: + raise ValueError(f"Molecule {payload['Molecules']} is known not to comply with standard CDMS format. " + f"Try get_molecule({payload['Molecules']}) instead.") + return response2 def _parse_result(self, response, *, verbose=False):