Skip to content

Commit 301ac9d

Browse files
committed
fix a logical bug for payload['Mol'] type and clarify in docstring that
there's no duplicated logic
1 parent b6d723f commit 301ac9d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

  • astroquery/linelists/jplspec

astroquery/linelists/jplspec/core.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,13 @@ def _resolve_molecules(self, molecule, *, flags=0, parse_name_locally=False):
201201
return [molecule]
202202

203203
def _build_table_from_get_molecule(self, mols):
204-
"""Fetch full catalog tables for each molecule and combine them."""
204+
"""
205+
Fetch full catalog tables for each molecule and combine them.
206+
207+
`mols` should be passed through `_resolve_molecules` before being
208+
sent to this function if it is user-specified, but if it comes directly
209+
from a query, it should be trusted as-is.
210+
"""
205211
self.lookup_ids = build_lookup()
206212
tbs = [self.get_molecule(mol) for mol in mols]
207213
if len(tbs) > 1:
@@ -252,7 +258,10 @@ def _parse_result(self, response, *, verbose=False, fallback_to_getmolecule=Fals
252258
if 'Zero lines were found' in response.text:
253259
if fallback_to_getmolecule:
254260
payload = parse_qs(response.request.body)
255-
return self._build_table_from_get_molecule(payload['Mol'])
261+
return self._build_table_from_get_molecule(
262+
[payload['Mol']]
263+
if isinstance(payload['Mol'], str)
264+
else payload['Mol'])
256265
raise EmptyResponseError(f"Response was empty; message was '{response.text}'.")
257266

258267
# data starts at 0 since regex was applied

0 commit comments

Comments
 (0)