Skip to content

Commit 4af365c

Browse files
authored
Merge pull request #2602 from bsipocz/MAINT_bump_astropy_41
MAINT: Bumping minimum required astropy version
2 parents b0a89ed + c626d8b commit 4af365c

File tree

18 files changed

+66
-146
lines changed

18 files changed

+66
-146
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ Infrastructure, Utility and Other Changes and Additions
209209

210210
- Removed deprecated function ``utils.download_list_of_fitsfiles()``. [#2594]
211211

212+
- Versions of astropy <4.2.1 and numpy <1.18 are no longer supported. [#2602]
213+
212214

213215

214216
0.4.6 (2022-03-22)

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Installation and Requirements
4343
-----------------------------
4444

4545
Astroquery works with Python 3.7 or later.
46-
As an `astropy`_ affiliate, astroquery requires `astropy`_ version 4.0 or later.
46+
As an `astropy`_ affiliate, astroquery requires `astropy`_ version 4.2.1 or later.
4747

4848
astroquery uses the `requests <https://requests.readthedocs.io/en/latest/>`_
4949
module to communicate with the internet. `BeautifulSoup

astroquery/alma/core.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,7 @@ def get_data_info(self, uids, *, expand_tarfiles=False,
579579
datalink_service_def_dict[adhoc_service.ID] = adhoc_service
580580

581581
temp = res.to_table()
582-
if commons.ASTROPY_LT_4_1:
583-
# very annoying
584-
for col in [x for x in temp.colnames
585-
if x not in ['content_length', 'readable']]:
586-
temp[col] = temp[col].astype(str)
582+
587583
result = temp if result is None else vstack([result, temp])
588584
to_delete = []
589585
for index, rr in enumerate(result):
@@ -1214,10 +1210,8 @@ def get_project_metadata(self, projectid, *, cache=True):
12141210
result = self.query_tap(
12151211
"select distinct proposal_abstract from "
12161212
"ivoa.obscore where proposal_id='{}'".format(projectid))
1217-
if commons.ASTROPY_LT_4_1:
1218-
return [result[0]['proposal_abstract'].astype(str)]
1219-
else:
1220-
return [result[0]['proposal_abstract']]
1213+
1214+
return [result[0]['proposal_abstract']]
12211215

12221216

12231217
Alma = AlmaClass()

astroquery/alma/tests/test_alma_remote.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
pass
1818

1919
from astroquery.exceptions import CorruptDataWarning
20-
from astroquery.utils.commons import ASTROPY_LT_4_1
2120
from .. import Alma
2221

2322
# ALMA tests involving staging take too long, leading to travis timeouts
@@ -283,14 +282,10 @@ def test_doc_example(self, tmp_path, alma):
283282
content_length_column_name = 'content_length'
284283

285284
uids = np.unique(m83_data['Member ous id'])
286-
if ASTROPY_LT_4_1:
287-
assert b'uid://A001/X11f/X30' in uids
288-
X30 = (m83_data['Member ous id'] == b'uid://A001/X11f/X30')
289-
X31 = (m83_data['Member ous id'] == b'uid://A002/X3216af/X31')
290-
else:
291-
assert 'uid://A001/X11f/X30' in uids
292-
X30 = (m83_data['Member ous id'] == 'uid://A001/X11f/X30')
293-
X31 = (m83_data['Member ous id'] == 'uid://A002/X3216af/X31')
285+
286+
assert 'uid://A001/X11f/X30' in uids
287+
X30 = (m83_data['Member ous id'] == 'uid://A001/X11f/X30')
288+
X31 = (m83_data['Member ous id'] == 'uid://A002/X3216af/X31')
294289

295290
assert X30.sum() == 4 # Jul 13, 2020
296291
assert X31.sum() == 4 # Jul 13, 2020

astroquery/alma/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from astropy import units as u
77
from astropy.coordinates import SkyCoord
8-
from astroquery.utils.commons import ASTROPY_LT_4_1
98

109
__all__ = ['parse_frequency_support', 'footprint_to_reg', 'approximate_primary_beam_sizes']
1110

@@ -48,8 +47,7 @@ def footprint_to_reg(footprint):
4847
-28.694332 266.521332 -28.699778'
4948
Some of them have *additional* polygons
5049
"""
51-
if ASTROPY_LT_4_1:
52-
footprint = footprint.decode('utf-8')
50+
5351
if footprint[:7] != 'Polygon' and footprint[:6] != 'Circle':
5452
raise ValueError("Unrecognized footprint type")
5553

astroquery/cadc/core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ def get_image_list(self, query_result, coordinates, radius):
457457
session=self.cadcdatalink._session)
458458
for service_def in datalink.bysemantics('#cutout'):
459459
access_url = service_def.access_url
460-
if isinstance(access_url, bytes): # ASTROPY_LT_4_1
461-
access_url = access_url.decode('ascii')
460+
462461
if '/sync' in access_url:
463462
service_params = service_def.input_params
464463
input_params = {param.name: param.value

astroquery/cadc/tests/test_cadctap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def get(*args, **kwargs):
218218
class CapsResponse:
219219
def __init__(self):
220220
self.status_code = 200
221-
self.content = b''
221+
self.content = ''
222222

223223
def raise_for_status(self):
224224
pass
@@ -298,7 +298,7 @@ def get(*args, **kwargs):
298298
class CapsResponse:
299299
def __init__(self):
300300
self.status_code = 200
301-
self.content = b''
301+
self.content = ''
302302

303303
def raise_for_status(self):
304304
pass
@@ -320,13 +320,13 @@ def __init__(self, **param_dict):
320320

321321
service_def1 = Mock()
322322
service_def1.access_url = \
323-
b'https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/sync'
323+
'https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/sync'
324324
service_def1.input_params = [Params(name='ID', value=uri),
325325
Params(name='RUNID', value=run_id)]
326326

327327
service_def2 = Mock()
328328
service_def2.access_url = \
329-
b'https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/async'
329+
'https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/async'
330330
service_def2.input_params = [Params(name='ID', value=uri),
331331
Params(name='RUNID', value=run_id)]
332332

astroquery/gaia/tests/test_gaiatap.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import astropy.units as u
3131
from astropy.coordinates.sky_coordinate import SkyCoord
3232
import numpy as np
33-
from astroquery.utils import ASTROPY_LT_4_1
3433
from astroquery.utils.tap.xmlparser import utils
3534
from astroquery.utils.tap.core import TapPlus
3635
from astroquery.utils.tap import taputils
@@ -50,8 +49,8 @@ def column_attrs():
5049
"table1_oid": np.int32
5150
}
5251
columns = {k: Column(name=k, description=k, dtype=v) for k, v in dtypes.items()}
53-
if not ASTROPY_LT_4_1:
54-
columns["source_id"].meta = {"_votable_string_dtype": "char"}
52+
53+
columns["source_id"].meta = {"_votable_string_dtype": "char"}
5554
return columns
5655

5756

astroquery/ipac/nexsci/nasa_exoplanet_archive/core.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,9 @@ def get_tap_tables():
115115
"""Tables accessed by API are gradually migrating to TAP service. Generate current list of tables in TAP."""
116116
tap = pyvo.dal.tap.TAPService(baseurl=conf.url_tap)
117117
response = tap.search(query="select * from TAP_SCHEMA.tables", language="ADQL")
118-
if not commons.ASTROPY_LT_4_1:
119-
tables = [table for table in response["table_name"].data if "TAP_SCHEMA." not in table]
120-
else:
121-
tables = [table.decode() for table in response["table_name"].data if b"TAP_SCHEMA." not in table]
118+
119+
tables = [table for table in response["table_name"].data if "TAP_SCHEMA." not in table]
120+
122121
return tables
123122

124123

astroquery/simbad/tests/test_simbad.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from ... import simbad
1212
from astroquery.utils.mocks import MockResponse
13-
from ...utils import commons
1413
from ...query import AstroQuery
1514
from ...exceptions import TableParseError
1615
from .test_simbad_remote import multicoords
@@ -440,6 +439,6 @@ def test_regression_issue388():
440439
response.content = f.read()
441440
parsed_table = simbad.Simbad._parse_result(response,
442441
simbad.core.SimbadVOTableResult)
443-
truth = b'M 1' if commons.ASTROPY_LT_4_1 else 'M 1'
442+
truth = 'M 1'
444443
assert parsed_table['MAIN_ID'][0] == truth
445444
assert len(parsed_table) == 1

0 commit comments

Comments
 (0)