Skip to content

Commit c053a46

Browse files
nkphysicsbsipocz
authored andcommitted
Refactor: Made ipac/ned kwargs keyword only
1 parent 4ca5342 commit c053a46

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

astroquery/ipac/ned/core.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class NedClass(BaseQuery):
4040
2: Options('Data as Published', 'pub'),
4141
3: Options('Homogenized Units (mJy)', 'mjy')}
4242

43-
def query_object(self, object_name, get_query_payload=False,
43+
def query_object(self, object_name, *, get_query_payload=False,
4444
verbose=False):
4545
"""
4646
Queries objects by name from the NED Service and returns the Main
@@ -71,7 +71,7 @@ def query_object(self, object_name, get_query_payload=False,
7171
result = self._parse_result(response, verbose=verbose)
7272
return result
7373

74-
def query_object_async(self, object_name, get_query_payload=False):
74+
def query_object_async(self, object_name, *, get_query_payload=False):
7575
"""
7676
Serves the same purpose as `~NedClass.query_object` but returns the
7777
raw HTTP response rather than the `astropy.table.Table` object.
@@ -101,7 +101,7 @@ def query_object_async(self, object_name, get_query_payload=False):
101101

102102
return response
103103

104-
def query_region(self, coordinates, radius=1 * u.arcmin, equinox='J2000.0',
104+
def query_region(self, coordinates, *, radius=1 * u.arcmin, equinox='J2000.0',
105105
get_query_payload=False, verbose=False):
106106
"""
107107
Used to query a region around a known identifier or given
@@ -144,7 +144,7 @@ def query_region(self, coordinates, radius=1 * u.arcmin, equinox='J2000.0',
144144
result = self._parse_result(response, verbose=verbose)
145145
return result
146146

147-
def query_region_async(self, coordinates, radius=1 * u.arcmin,
147+
def query_region_async(self, coordinates, *, radius=1 * u.arcmin,
148148
equinox='J2000.0', get_query_payload=False):
149149
"""
150150
Serves the same purpose as `~NedClass.query_region` but returns the
@@ -206,7 +206,7 @@ def query_region_async(self, coordinates, radius=1 * u.arcmin,
206206
params=request_payload, timeout=Ned.TIMEOUT)
207207
return response
208208

209-
def query_region_iau(self, iau_name, frame='Equatorial', equinox='B1950.0',
209+
def query_region_iau(self, iau_name, *, frame='Equatorial', equinox='B1950.0',
210210
get_query_payload=False, verbose=False):
211211
"""
212212
Used to query the Ned service via the IAU name. Equivalent to the
@@ -245,7 +245,7 @@ def query_region_iau(self, iau_name, frame='Equatorial', equinox='B1950.0',
245245
result = self._parse_result(response, verbose=verbose)
246246
return result
247247

248-
def query_region_iau_async(self, iau_name, frame='Equatorial',
248+
def query_region_iau_async(self, iau_name, *, frame='Equatorial',
249249
equinox='B1950.0', get_query_payload=False):
250250
"""
251251
Serves the same purpose as `~NedClass.query_region_iau` but returns
@@ -285,7 +285,7 @@ def query_region_iau_async(self, iau_name, frame='Equatorial',
285285
params=request_payload, timeout=Ned.TIMEOUT)
286286
return response
287287

288-
def query_refcode(self, refcode, get_query_payload=False, verbose=False):
288+
def query_refcode(self, refcode, *, get_query_payload=False, verbose=False):
289289
"""
290290
Used to retrieve all objects contained in a particular
291291
reference. Equivalent to by refcode queries of the web interface.
@@ -314,7 +314,7 @@ def query_refcode(self, refcode, get_query_payload=False, verbose=False):
314314
result = self._parse_result(response, verbose=verbose)
315315
return result
316316

317-
def query_refcode_async(self, refcode, get_query_payload=False):
317+
def query_refcode_async(self, refcode, *, get_query_payload=False):
318318
"""
319319
Serves the same purpose as `~NedClass.query_region` but returns the
320320
raw HTTP response rather than the `astropy.table.Table` object.
@@ -344,7 +344,7 @@ def query_refcode_async(self, refcode, get_query_payload=False):
344344
params=request_payload, timeout=Ned.TIMEOUT)
345345
return response
346346

347-
def get_images(self, object_name, get_query_payload=False,
347+
def get_images(self, object_name, *, get_query_payload=False,
348348
show_progress=True):
349349
"""
350350
Query function to fetch FITS images for a given identifier.
@@ -370,7 +370,7 @@ def get_images(self, object_name, get_query_payload=False,
370370
return readable_objs
371371
return [obj.get_fits() for obj in readable_objs]
372372

373-
def get_images_async(self, object_name, get_query_payload=False,
373+
def get_images_async(self, object_name, *, get_query_payload=False,
374374
show_progress=True):
375375
"""
376376
Serves the same purpose as `~NedClass.get_images` but returns
@@ -397,7 +397,7 @@ def get_images_async(self, object_name, get_query_payload=False,
397397
show_progress=show_progress)
398398
for U in image_urls]
399399

400-
def get_spectra(self, object_name, get_query_payload=False,
400+
def get_spectra(self, object_name, *, get_query_payload=False,
401401
show_progress=True):
402402
"""
403403
Query function to fetch FITS files of spectra for a given identifier.
@@ -423,7 +423,7 @@ def get_spectra(self, object_name, get_query_payload=False,
423423
return readable_objs
424424
return [obj.get_fits() for obj in readable_objs]
425425

426-
def get_spectra_async(self, object_name, get_query_payload=False,
426+
def get_spectra_async(self, object_name, *, get_query_payload=False,
427427
show_progress=True):
428428
"""
429429
Serves the same purpose as `~NedClass.get_spectra` but returns
@@ -490,7 +490,7 @@ def get_image_list(self, object_name, *, item='image', file_format='fits',
490490
timeout=Ned.TIMEOUT)
491491
return self._extract_image_urls(response.text, file_format=file_format)
492492

493-
def _extract_image_urls(self, html_in, file_format='fits'):
493+
def _extract_image_urls(self, html_in, *, file_format='fits'):
494494
"""
495495
Helper function that uses regexps to extract the image urls from the
496496
given HTML.
@@ -524,7 +524,7 @@ def _extract_image_urls(self, html_in, file_format='fits'):
524524
url_list = [base_url + img_url for img_url in matched_urls]
525525
return url_list
526526

527-
def get_table(self, object_name, table='photometry',
527+
def get_table(self, object_name, *, table='photometry',
528528
get_query_payload=False, verbose=False, **kwargs):
529529
"""
530530
Fetches the specified data table for the object from NED and returns
@@ -574,7 +574,7 @@ def get_table(self, object_name, table='photometry',
574574
result = self._parse_result(response, verbose=verbose)
575575
return result
576576

577-
def get_table_async(self, object_name, table='photometry',
577+
def get_table_async(self, object_name, *, table='photometry',
578578
get_query_payload=False, **kwargs):
579579
"""
580580
Serves the same purpose as `~NedClass.query_region` but returns the
@@ -678,7 +678,7 @@ def _set_output_options(self, request_payload):
678678
request_payload['out_equinox'] = conf.output_equinox
679679
request_payload['obj_sort'] = conf.sort_output_by
680680

681-
def _parse_result(self, response, verbose=False):
681+
def _parse_result(self, response, *, verbose=False):
682682
"""
683683
Parses the raw HTTP response and returns it as an
684684
`astropy.table.Table`.

astroquery/ipac/ned/tests/test_ned.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def test_get_images(patch_get, patch_get_readable_fileobj):
167167

168168

169169
def test_query_refcode_async(patch_get):
170-
response = ned.core.Ned.query_refcode_async('1997A&A...323...31K', True)
170+
response = ned.core.Ned.query_refcode_async('1997A&A...323...31K', get_query_payload=True)
171171
assert response == {'search_type': 'Search',
172172
'refcode': '1997A&A...323...31K',
173173
'hconst': conf.hubble_constant,

0 commit comments

Comments
 (0)