From 869de3d117a9977a438c9c2da086537bc986f522 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Mon, 18 Dec 2023 19:54:34 -0500 Subject: [PATCH] allow lookuptable to skip regex searching for exact matches --- astroquery/jplspec/lookup_table.py | 5 ++++- astroquery/linelists/cdms/core.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/astroquery/jplspec/lookup_table.py b/astroquery/jplspec/lookup_table.py index 27a2501690..40bdd2a091 100644 --- a/astroquery/jplspec/lookup_table.py +++ b/astroquery/jplspec/lookup_table.py @@ -22,10 +22,13 @@ def find(self, s, flags): Returns ------- - The list of values corresponding to the matches + The dictionary containing only values whose keys match the regex """ + if s in self: + return {s: self[s]} + R = re.compile(s, flags) out = {} diff --git a/astroquery/linelists/cdms/core.py b/astroquery/linelists/cdms/core.py index 8ebe9496ab..1b892609dd 100644 --- a/astroquery/linelists/cdms/core.py +++ b/astroquery/linelists/cdms/core.py @@ -375,10 +375,13 @@ def find(self, st, flags): Returns ------- - The list of values corresponding to the matches + The dictionary containing only values whose keys match the regex """ + if st in self: + return {st: self[st]} + out = {} for kk, vv in self.items():