Skip to content

Commit e8fff0b

Browse files
authored
Merge pull request #3089 from mkelley/mpc-deprecate-raw-response
Deprecate raw response from non-async method
2 parents 8b9df19 + 274984f commit e8fff0b

File tree

7 files changed

+53
-166
lines changed

7 files changed

+53
-166
lines changed

CHANGES.rst

+22-1
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,23 @@ mpc
4343
^^^
4444

4545
- Parse star catalog information when querying observations database [#2957]
46+
4647
- Parse ephemeris with sky motion with three digit precision [#3026]
47-
- Raise EmptyResponseError when empty ephemeris reponse is returned [#3026]
48+
49+
- Raise EmptyResponseError when empty ephemeris response is returned [#3026]
50+
51+
- Deprecate ``get_raw_response`` parameter from ``MPC.get_observations``. The
52+
raw response may be retrieved from the _async() method. [#3089]
53+
54+
- Remove ``get_raw_response`` parameter from ``MPC.get_ephemeris`` and
55+
``MPC.get_observatory_codes`` without deprecation as the parameters were
56+
ignored and had no effect. [#3089]
57+
58+
- Fix bug in ``MPC.get_ephemeris`` that caused the ``cache`` keyword parameter
59+
to be ignored. [#3089]
60+
61+
- Remove ``comettype`` parameter from ``MPC.get_observations`` without
62+
deprecation: it was undocumented, ignored, and had no effect. [#3089]
4863

4964
linelists.cdms
5065
^^^^^^^^^^^^^^
@@ -191,6 +206,12 @@ mast
191206
- Support for case-insensitive criteria keyword arguments in ``mast.Observations.query_criteria`` and
192207
``mast.Catalogs.query_criteria``. [#3087]
193208

209+
mpc
210+
^^^
211+
212+
- Rename ``MPC.get_mpc_object_endpoint`` to ``MPC._get_mpc_object_endpoint`` to
213+
indicate that it is a private method. [#3089]
214+
194215

195216
0.4.7 (2024-03-08)
196217
==================

astroquery/mpc/core.py

+15-16
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from . import conf
1818
from ..utils import async_to_sync, class_or_instance
1919
from ..exceptions import InvalidQueryError, EmptyResponseError
20+
from astropy.utils.decorators import deprecated_renamed_argument
2021

2122
__all__ = ['MPCClass']
2223

@@ -186,7 +187,7 @@ def query_object_async(self, target_type, *, get_query_payload=False, **kwargs):
186187
187188
"""
188189

189-
self.get_mpc_object_endpoint(target_type)
190+
self._get_mpc_object_endpoint(target_type)
190191

191192
kwargs['limit'] = 1
192193
return self.query_objects_async(target_type, get_query_payload=get_query_payload, **kwargs)
@@ -315,7 +316,7 @@ def query_objects_async(self, target_type, *, get_query_payload=False, **kwargs)
315316
Limit the number of results to the given value
316317
317318
"""
318-
mpc_endpoint = self.get_mpc_object_endpoint(target_type)
319+
mpc_endpoint = self._get_mpc_object_endpoint(target_type)
319320

320321
if (target_type == 'comet'):
321322
kwargs['order_by_desc'] = "epoch"
@@ -329,7 +330,7 @@ def query_objects_async(self, target_type, *, get_query_payload=False, **kwargs)
329330
auth = (self.MPC_USERNAME, self.MPC_PASSWORD)
330331
return self._request('GET', mpc_endpoint, params=request_args, auth=auth)
331332

332-
def get_mpc_object_endpoint(self, target_type):
333+
def _get_mpc_object_endpoint(self, target_type):
333334
mpc_endpoint = self.MPC_URL
334335
if target_type == 'asteroid':
335336
mpc_endpoint = mpc_endpoint + '/search_orbits'
@@ -344,8 +345,7 @@ def get_ephemeris_async(self, target, *, location='500', start=None, step='1d',
344345
proper_motion='total', proper_motion_unit='arcsec/h',
345346
suppress_daytime=False, suppress_set=False,
346347
perturbed=True, unc_links=False,
347-
get_query_payload=False,
348-
get_raw_response=False, cache=False):
348+
get_query_payload=False, cache=False):
349349
r"""
350350
Object ephemerides from the Minor Planet Ephemeris Service.
351351
@@ -436,10 +436,6 @@ def get_ephemeris_async(self, target, *, location='500', start=None, step='1d',
436436
Return the HTTP request parameters as a dictionary
437437
(default: ``False``).
438438
439-
get_raw_response : bool, optional
440-
Return raw data without parsing into a table (default:
441-
``False``).
442-
443439
cache : bool
444440
Defaults to False. If set overrides global caching behavior.
445441
See :ref:`caching documentation <astroquery_cache>`.
@@ -486,7 +482,7 @@ def get_ephemeris_async(self, target, *, location='500', start=None, step='1d',
486482
| P/2003 CP7 | Comet P/2003 CP7 (LINEAR-NEAT) |
487483
+------------+-----------------------------------+
488484
489-
For comets, P/ and C/ are interchangable. The designation
485+
For comets, P/ and C/ are interchangeable. The designation
490486
may also be in a packed format:
491487
492488
+------------+-----------------------------------+
@@ -601,21 +597,18 @@ def get_ephemeris_async(self, target, *, location='500', start=None, step='1d',
601597
return request_args
602598

603599
self.query_type = 'ephemeris'
604-
response = self._request('POST', self.MPES_URL, data=request_args)
600+
response = self._request('POST', self.MPES_URL, data=request_args, cache=cache)
605601

606602
return response
607603

608604
@class_or_instance
609-
def get_observatory_codes_async(self, *, get_raw_response=False, cache=True):
605+
def get_observatory_codes_async(self, *, cache=True):
610606
"""
611607
Table of observatory codes from the IAU Minor Planet Center.
612608
613609
614610
Parameters
615611
----------
616-
get_raw_response : bool, optional
617-
Return raw data without parsing into a table (default:
618-
`False`).
619612
620613
cache : bool
621614
Defaults to True. If set overrides global caching behavior.
@@ -771,9 +764,10 @@ def _args_to_ephemeris_payload(self, **kwargs):
771764
return request_args
772765

773766
@class_or_instance
767+
@deprecated_renamed_argument("get_raw_response", None, since="0.4.8",
768+
alternative="async methods")
774769
def get_observations_async(self, targetid, *,
775770
id_type=None,
776-
comettype=None,
777771
get_mpcformat=False,
778772
get_raw_response=False,
779773
get_query_payload=False,
@@ -783,6 +777,11 @@ def get_observations_async(self, targetid, *,
783777
from the `Minor Planet Center observations database
784778
<https://minorplanetcenter.net/db_search>`_.
785779
780+
.. deprecated:: 0.4.8
781+
The ``get_raw_response`` keyword argument is deprecated. The
782+
`~MPCClass.get_observations_async` method will return a raw response.
783+
784+
786785
Parameters
787786
----------
788787
targetid : int or str

astroquery/mpc/tests/data/1994XG_ephemeris_500-a-t.html

-61
This file was deleted.

0 commit comments

Comments
 (0)