Skip to content

Commit 7212212

Browse files
committed
Fix numpy deprecation warning by switching to use Table.read for reading response
1 parent af8d510 commit 7212212

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

astroquery/sdss/core.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -896,21 +896,15 @@ def _parse_result(self, response, verbose=False):
896896
table : `~astropy.table.Table`
897897
898898
"""
899+
if 'error_message' in response.text:
900+
raise RemoteServiceError(response.text)
899901

900-
if 'error_message' in io.BytesIO(response.content):
901-
raise RemoteServiceError(response.content)
902-
skip_header = 0
903-
if response.content.startswith(b'#Table'):
904-
skip_header = 1
905-
arr = np.atleast_1d(np.genfromtxt(io.BytesIO(response.content),
906-
names=True, dtype=None,
907-
delimiter=',', skip_header=skip_header,
908-
comments='#'))
902+
arr = Table.read(response.text, format='ascii.csv', comment="#")
909903

910904
if len(arr) == 0:
911905
return None
912906
else:
913-
return Table(arr)
907+
return arr
914908

915909
def _args_to_payload(self, coordinates=None,
916910
fields=None, spectro=False, region=False,

astroquery/sdss/tests/test_sdss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def url_tester_crossid(data_release):
144144

145145
def compare_xid_data(xid, data):
146146
for col in xid.colnames:
147-
if xid[col].dtype.type is np.string_:
147+
if xid[col].dtype.type is np.str_:
148148
assert xid[col] == data[col]
149149
else:
150150
assert_allclose(xid[col], data[col])

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ filterwarnings =
3939
# This is a temporary measure, all of these should be fixed:
4040
ignore:distutils Version classes are deprecated:DeprecationWarning
4141
ignore::pytest.PytestUnraisableExceptionWarning
42-
ignore::numpy.VisibleDeprecationWarning
4342
ignore:unclosed <ssl.SSLSocket:ResourceWarning
4443
ignore::UserWarning
4544
ignore::astroquery.exceptions.InputWarning

0 commit comments

Comments
 (0)