Skip to content

Commit c4dde9d

Browse files
authored
Merge pull request #1884 from nataliekorzh/deprecationerror
Removed old deprecation warnings
2 parents cabed22 + e101ac1 commit c4dde9d

File tree

5 files changed

+11
-87
lines changed

5 files changed

+11
-87
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ mast
2424
- Added ``Observations.download_file`` method to download a single file from MAST given an input
2525
data URI. [#1825]
2626
- Added case for passing a row to ``Observations.download_file` [#1881]
27+
- Removed deprecated ``Observations.get_hst_s3_uris()``, ``Observations.get_hst_s3_uri()``,
28+
``Core.get_token()``, ``Core.enable_s3_hst_dataset()``, ``Core.disable_s3_hst_dataset()`` and
29+
variables obstype and silent [#1884]
2730

2831
esa/hubble
2932
^^^^^^^^^^

astroquery/mast/core.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import warnings
1010

1111
from astropy.utils import deprecated
12-
from astropy.utils.exceptions import AstropyDeprecationWarning
1312

1413
from ..query import QueryWithLogin
1514

@@ -66,19 +65,12 @@ def _login(self, token=None, store_token=False, reenter_token=False):
6665

6766
return self._auth_obj.login(token, store_token, reenter_token)
6867

69-
@deprecated(since="v0.3.9", message=("The get_token function is deprecated, "
70-
"session token is now the token used for login."))
71-
def get_token(self):
72-
return None
73-
74-
def session_info(self, silent=None, verbose=None):
68+
def session_info(self, verbose=True):
7569
"""
7670
Displays information about current MAST user, and returns user info dictionary.
7771
7872
Parameters
7973
----------
80-
silent :
81-
Deprecated. Use verbose instead.
8274
verbose : bool, optional
8375
Default True. Set to False to suppress output to stdout.
8476
@@ -87,18 +79,6 @@ def session_info(self, silent=None, verbose=None):
8779
response : dict
8880
"""
8981

90-
# Dealing with deprecated argument
91-
if (silent is not None) and (verbose is not None):
92-
warnings.warn(("Argument 'silent' has been deprecated, "
93-
"will be ignored in favor of 'verbose'"), AstropyDeprecationWarning)
94-
elif silent is not None:
95-
warnings.warn(("Argument 'silent' has been deprecated, "
96-
"and will be removed in the future. "
97-
" Use 'verbose' instead."), AstropyDeprecationWarning)
98-
verbose = not silent
99-
elif (silent is None) and (verbose is None):
100-
verbose = True
101-
10282
return self._auth_obj.session_info(verbose)
10383

10484
def logout(self):
@@ -108,10 +88,6 @@ def logout(self):
10888
self._auth_obj.logout()
10989
self._authenticated = False
11090

111-
@deprecated(since="v0.3.9", alternative="enable_cloud_dataset")
112-
def enable_s3_hst_dataset(self):
113-
return self.enable_cloud_dataset()
114-
11591
def enable_cloud_dataset(self, provider="AWS", profile=None, verbose=True):
11692
"""
11793
Enable downloading public files from S3 instead of MAST.
@@ -131,10 +107,6 @@ def enable_cloud_dataset(self, provider="AWS", profile=None, verbose=True):
131107

132108
self._cloud_connection = CloudAccess(provider, profile, verbose)
133109

134-
@deprecated(since="v0.3.9", alternative="disable_cloud_dataset")
135-
def disable_s3_hst_dataset(self):
136-
return self.disable_cloud_dataset()
137-
138110
def disable_cloud_dataset(self):
139111
"""
140112
Disables downloading public files from S3 instead of MAST

astroquery/mast/observations.py

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
from astropy.utils import deprecated
2727
from astropy.utils.console import ProgressBarOrSpinner
28-
from astropy.utils.exceptions import AstropyDeprecationWarning
2928

3029
from six.moves.urllib.parse import quote as urlencode
3130

@@ -151,28 +150,6 @@ def _parse_caom_criteria(self, **criteria):
151150
objectname = criteria.pop('objectname', None)
152151
radius = criteria.pop('radius', 0.2*u.deg)
153152

154-
# Dealing with observation type (science vs calibration)
155-
if ('obstype' in criteria) and ('intentType' in criteria):
156-
warn_string = ("Cannot specify both obstype and intentType, "
157-
"obstype is the deprecated version of intentType and will be ignored.")
158-
warnings.warn(warn_string, InputWarning)
159-
criteria.pop('obstype', None)
160-
161-
# Temporarily issuing warning about change in behavior
162-
# continuing old behavior
163-
# grabbing the observation type (science vs calibration)
164-
obstype = criteria.pop('obstype', None)
165-
if obstype:
166-
warn_string = ("Criteria obstype argument disappeared in May 2019. "
167-
"Criteria 'obstype' is now 'intentType', options are 'science' or 'calibration', "
168-
"if intentType is not supplied all observations (science and calibration) are returned.")
169-
warnings.warn(warn_string, AstropyDeprecationWarning)
170-
171-
if obstype == "science":
172-
criteria["intentType"] = "science"
173-
elif obstype == "cal":
174-
criteria["intentType"] = "calibration"
175-
176153
# Build the mashup filter object and store it in the correct service_name entry
177154
if coordinates or objectname:
178155
mashup_filters = self._portal_api_connection.build_filter_set("Mast.Caom.Cone",
@@ -452,11 +429,11 @@ def get_product_list_async(self, observations):
452429
"""
453430

454431
# getting the obsid list
455-
if type(observations) == Row:
432+
if isinstance(observations, Row):
456433
observations = observations["obsid"]
457434
if np.isscalar(observations):
458435
observations = [observations]
459-
if type(observations) == Table:
436+
if isinstance(observations, Table):
460437
observations = observations['obsid']
461438

462439
service = 'Mast.Caom.Products'
@@ -496,7 +473,7 @@ def filter_products(self, products, mrp_only=False, extension=None, **filters):
496473
filter_mask &= (products['productGroupDescription'] == "Minimum Recommended Products")
497474

498475
if extension:
499-
if type(extension) == str:
476+
if isinstance(extension, str):
500477
extension = [extension]
501478

502479
mask = np.full(len(products), False, dtype=bool)
@@ -508,7 +485,7 @@ def filter_products(self, products, mrp_only=False, extension=None, **filters):
508485
# Applying the rest of the filters
509486
for colname, vals in filters.items():
510487

511-
if type(vals) == str:
488+
if isinstance(vals, str):
512489
vals = [vals]
513490

514491
mask = np.full(len(products), False, dtype=bool)
@@ -711,14 +688,14 @@ def download_products(self, products, download_dir=None,
711688
The manifest of files downloaded, or status of files on disk if curl option chosen.
712689
"""
713690
# If the products list is a row we need to cast it as a table
714-
if type(products) == Row:
691+
if isinstance(products, Row):
715692
products = Table(products, masked=True)
716693

717694
# If the products list is not already a table of products we need to
718695
# get the products and filter them appropriately
719-
if type(products) != Table:
696+
if not isinstance(products, Table):
720697

721-
if type(products) == str:
698+
if isinstance(products, str):
722699
products = [products]
723700

724701
# collect list of products
@@ -748,10 +725,6 @@ def download_products(self, products, download_dir=None,
748725

749726
return manifest
750727

751-
@deprecated(since="v0.3.9", alternative="get_cloud_uris")
752-
def get_hst_s3_uris(self, data_products, include_bucket=True, full_url=False):
753-
return self.get_cloud_uris(data_products, include_bucket, full_url)
754-
755728
def get_cloud_uris(self, data_products, include_bucket=True, full_url=False):
756729
"""
757730
Takes an `~astropy.table.Table` of data products and returns the associated cloud data uris.
@@ -780,10 +753,6 @@ def get_cloud_uris(self, data_products, include_bucket=True, full_url=False):
780753

781754
return self._cloud_connection.get_cloud_uri_list(data_products, include_bucket, full_url)
782755

783-
@deprecated(since="v0.3.9", alternative="get_cloud_uri")
784-
def get_hst_s3_uri(self, data_product, include_bucket=True, full_url=False):
785-
return self.get_cloud_uri(data_product, include_bucket, full_url)
786-
787756
def get_cloud_uri(self, data_product, include_bucket=True, full_url=False):
788757
"""
789758
For a given data product, returns the associated cloud URI.

astroquery/mast/tests/test_mast.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -270,16 +270,6 @@ def test_observations_query_criteria(patch_post):
270270
objectname="M101")
271271
assert isinstance(result, Table)
272272

273-
# TEMPORARY test the obstype deprecation
274-
with catch_warnings(AstropyDeprecationWarning) as warning_lines:
275-
result = mast.Observations.query_criteria(objectname="M101",
276-
dataproduct_type="IMAGE", obstype="science")
277-
assert isinstance(result, Table)
278-
279-
with pytest.warns(InputWarning) as i_w:
280-
mast.Observations.query_criteria(obstype="science", intentType="science")
281-
assert "obstype and intentType" in str(i_w[0].message)
282-
283273
with pytest.raises(InvalidQueryError) as invalid_query:
284274
mast.Observations.query_criteria(objectname="M101")
285275
assert "least one non-positional criterion" in str(invalid_query.value)

astroquery/mast/tests/test_mast_remote.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,6 @@ def test_observations_query_criteria(self):
175175
assert (result['obs_collection'] == 'GALEX').all()
176176
assert sum(result['filters'] == 'NUV') == 6
177177

178-
# TEMPORARY test the obstype deprecation
179-
with catch_warnings(AstropyDeprecationWarning) as warning_lines:
180-
result = mast.Observations.query_criteria(objectname="M101",
181-
dataproduct_type="IMAGE", obstype="science")
182-
assert (result["intentType"] == "science").all()
183-
184-
result = mast.Observations.query_criteria(objectname="M101",
185-
dataproduct_type="IMAGE", obstype="cal")
186-
assert (result["intentType"] == "calibration").all()
187-
188178
result = mast.Observations.query_criteria(objectname="M101",
189179
dataproduct_type="IMAGE", intentType="calibration")
190180
assert (result["intentType"] == "calibration").all()

0 commit comments

Comments
 (0)