Fix NAIF ID typos in Most: nafid -> naifid#3607
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3607 +/- ##
==========================================
- Coverage 73.21% 73.19% -0.03%
==========================================
Files 226 226
Lines 21053 21040 -13
==========================================
- Hits 15414 15400 -14
- Misses 5639 5640 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3400b3e to
52e7def
Compare
Fixes astropy#3605. The MOST cgi-bin API expects 'naifid' but the astroquery code had 'nafid' (missing the 'i') in multiple places, causing NAIF ID queries to fail. Confirmed against the IRSA MOST API docs. Changes in astroquery/ipac/irsa/most.py: - _validate_nafid_input_type: fix the dict key checked and the error message - _validate_input: fix the dispatch key and the unrecognized-input error message - get_images and query_object signatures: add obj_naifid parameter, keep obj_nafid as deprecated - get_images and query_object bodies: handle the deprecated 'nafid_input' input_mode and 'obj_nafid' keyword, remapping to the correct names with AstropyDeprecationWarning - qparams dict in query_object: fix the POST key from 'obj_nafid' to 'obj_naifid' Added two tests: - test_naifid_input: verifies the corrected spelling works - test_nafid_deprecation: verifies the deprecated spellings emit AstropyDeprecationWarning
52e7def to
6e2bb25
Compare
bsipocz
left a comment
There was a problem hiding this comment.
Thanks for working on this. However the approach is not exactly correct, we have a deprecating decorator that makes this much cleaner and simpler. Could you please update the PR to use that?
| # Handle deprecated parameters | ||
| if obj_nafid is not None and obj_naifid is None: | ||
| warnings.warn( | ||
| "'obj_nafid' is deprecated; use 'obj_naifid' instead (the API parameter is 'obj_naifid').", | ||
| AstropyDeprecationWarning, | ||
| stacklevel=2, | ||
| ) | ||
| obj_naifid = obj_nafid | ||
| if input_mode == "nafid_input": | ||
| warnings.warn( | ||
| "'nafid_input' is deprecated; use 'naifid_input' instead (the API value is 'naifid_input').", | ||
| AstropyDeprecationWarning, | ||
| stacklevel=2, | ||
| ) | ||
| input_mode = "naifid_input" | ||
|
|
There was a problem hiding this comment.
deprecations of this kind of renaming should be done with the @deprecated_renamed_argument decorator (from astropy.utils.decorators)
See examples in the other astroquery modules.
bsipocz
left a comment
There was a problem hiding this comment.
Minor cleanup is needed that I'll commit to the PR and then merge.
Thanks for the fix!
Co-authored-by: Brigitta Sipőcz <b.sipocz@gmail.com>
Fixes #3605.
The MOST cgi-bin API expects
naifidbut the astroquery code hadnafid(missing the 'i') in multiple places, so NAIF ID queries were silently broken. Confirmed against the IRSA MOST API docs (MOSTProgramInterface.html).Changes:
_validate_nafid_input_type: fix the dict key and error message_validate_input: fix the dispatch key and the unrecognized-input error messageget_imagesandquery_objectsignatures: addobj_naifidparameterget_imagesandquery_objectbodies: handle the deprecatedobj_nafidkeyword and"nafid_input"input_mode, remapping to the correct names withAstropyDeprecationWarningqparamsdict inquery_object: fix the POST key fromobj_nafidtoobj_naifidTests:
test_naifid_input: verifies the corrected spelling actually works against the mocktest_nafid_deprecation: verifies the deprecated spellings emitAstropyDeprecationWarning8/8 most tests pass. CHANGES.rst entry under
ipac.irsain 'Service fixes and enhancements'.