16
16
__all__ = ['Heasarc' , 'HeasarcClass' ]
17
17
18
18
19
+ def Table_read (* args , ** kwargs ):
20
+ # why does if commons.ASTROPY_LT_5_0 not work on Windows?
21
+ try :
22
+ return Table .read (* args , ** kwargs , unit_parse_strict = 'silent' )
23
+ except TypeError :
24
+ return Table .read (* args , ** kwargs )
25
+
26
+
19
27
@async_to_sync
20
28
class HeasarcClass (BaseQuery ):
21
29
@@ -191,10 +199,7 @@ def _old_w3query_fallback(self, content):
191
199
f .writeto (I )
192
200
I .seek (0 )
193
201
194
- try :
195
- return Table .read (I )
196
- except :
197
- return Table .read (I , unit_parse_strict = 'silent' )
202
+ return Table_read (I )
198
203
199
204
def _fallback (self , text ):
200
205
"""
@@ -225,10 +230,7 @@ def _fallback(self, text):
225
230
226
231
data = StringIO (text .replace (old_table , "\n " .join (new_table )))
227
232
228
- try :
229
- return Table .read (data , hdu = 1 )
230
- except :
231
- return Table .read (data , hdu = 1 , unit_parse_strict = 'silent' )
233
+ return Table_read (data , hdu = 1 )
232
234
233
235
def _parse_result (self , response , verbose = False ):
234
236
# if verbose is False then suppress any VOTable related warnings
@@ -249,12 +251,7 @@ def _parse_result(self, response, verbose=False):
249
251
250
252
try :
251
253
data = BytesIO (response .content )
252
-
253
- # why does if commons.ASTROPY_LT_5_0 not work on Windows?
254
- try :
255
- return Table .read (data , hdu = 1 )
256
- except :
257
- return Table .read (data , hdu = 1 , unit_parse_strict = 'silent' )
254
+ return Table_read (data , hdu = 1 )
258
255
except ValueError :
259
256
try :
260
257
return self ._fallback (response .text )
0 commit comments