Skip to content

Commit 1d1419f

Browse files
committed
case insensitive filters, remote tests
do not call network for default initializations of Catalogs
1 parent 9652696 commit 1d1419f

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

astroquery/mast/catalog_collection.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,7 @@ def get_parent_collection(cls, collection_name):
122122
The user-facing collection name to get the parent collection for.
123123
"""
124124
if cls._collection_parent_map is None:
125-
try:
126-
cls.discover_collections()
127-
except Exception as ex:
128-
log.debug(f"Failed to discover TAP collections; falling back to direct endpoint routing: {ex}")
129-
cls._collection_parent_map = {}
125+
cls.discover_collections()
130126

131127
normalized_name = collection_name.lower().strip()
132128
parent_collection = cls._collection_parent_map.get(normalized_name, normalized_name)
@@ -480,13 +476,14 @@ def _verify_criteria(self, catalog, **criteria):
480476
if not criteria:
481477
return
482478
col_names = list(self.get_catalog_metadata(catalog).column_metadata['column_name'])
479+
col_name_lookup = {col.lower(): col for col in col_names}
483480

484481
# Check each criteria argument for validity
485482
for kwd in criteria.keys():
486-
if kwd not in col_names:
483+
if kwd.lower() not in col_name_lookup:
487484
# Suggest closest match for invalid keyword
488-
closest = difflib.get_close_matches(kwd, col_names, n=1)
489-
suggestion = f" Did you mean '{closest[0]}'?" if closest else ""
485+
closest = difflib.get_close_matches(kwd.lower(), list(col_name_lookup.keys()), n=1)
486+
suggestion = f" Did you mean '{col_name_lookup[closest[0]]}'?" if closest else ""
490487
raise InvalidQueryError(
491488
f"Filter '{kwd}' is not recognized for collection '{self.name}' and "
492489
f"catalog '{catalog}'.{suggestion}"

0 commit comments

Comments
 (0)