Skip to content

Commit ee42d01

Browse files
committed
refactor: make simbad kwargs kwarg-only (except in one case)
1 parent 2ac0cb8 commit ee42d01

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

astroquery/simbad/core.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ def query_criteria_async(self, *args, **kwargs):
500500
timeout=self.TIMEOUT, cache=cache)
501501
return response
502502

503-
def query_object(self, object_name, wildcard=False, verbose=False,
503+
def query_object(self, object_name, *, wildcard=False, verbose=False,
504504
get_query_payload=False):
505505
"""
506506
Queries Simbad for the given object and returns the result as a
@@ -531,7 +531,7 @@ def query_object(self, object_name, wildcard=False, verbose=False,
531531
return self._parse_result(response, SimbadVOTableResult,
532532
verbose=verbose)
533533

534-
def query_object_async(self, object_name, wildcard=False, cache=True,
534+
def query_object_async(self, object_name, *, wildcard=False, cache=True,
535535
get_query_payload=False):
536536

537537
"""
@@ -564,7 +564,7 @@ def query_object_async(self, object_name, wildcard=False, cache=True,
564564
timeout=self.TIMEOUT, cache=cache)
565565
return response
566566

567-
def query_objects(self, object_names, wildcard=False, verbose=False,
567+
def query_objects(self, object_names, *, wildcard=False, verbose=False,
568568
get_query_payload=False):
569569
"""
570570
Queries Simbad for the specified list of objects and returns the
@@ -590,7 +590,7 @@ def query_objects(self, object_names, wildcard=False, verbose=False,
590590
return self.query_object('\n'.join(object_names), wildcard=wildcard,
591591
get_query_payload=get_query_payload)
592592

593-
def query_objects_async(self, object_names, wildcard=False, cache=True,
593+
def query_objects_async(self, object_names, *, wildcard=False, cache=True,
594594
get_query_payload=False):
595595
"""
596596
Same as `query_objects`, but only collects the response from the
@@ -616,7 +616,7 @@ def query_objects_async(self, object_names, wildcard=False, cache=True,
616616
wildcard=wildcard, cache=cache,
617617
get_query_payload=get_query_payload)
618618

619-
def query_region_async(self, coordinates, radius=2*u.arcmin,
619+
def query_region_async(self, coordinates, radius=2*u.arcmin, *,
620620
equinox=2000.0, epoch='J2000', cache=True,
621621
get_query_payload=False):
622622
"""
@@ -627,9 +627,8 @@ def query_region_async(self, coordinates, radius=2*u.arcmin,
627627
----------
628628
coordinates : str or `astropy.coordinates` object
629629
the identifier or coordinates around which to query.
630-
radius : str or `~astropy.units.Quantity`, optional
631-
the radius of the region. If missing, set to default
632-
value of 2 arcmin.
630+
radius : str or `~astropy.units.Quantity`
631+
the radius of the region. Defaults to 2 arcmin.
633632
equinox : float, optional
634633
the equinox of the coordinates. If missing set to
635634
default 2000.0.
@@ -651,9 +650,6 @@ def query_region_async(self, coordinates, radius=2*u.arcmin,
651650

652651
base_query_str = "query coo {ra} {dec} radius={rad} frame={frame} equi={equinox}"
653652

654-
if radius is None:
655-
radius = 2*u.arcmin
656-
657653
header = self._get_query_header()
658654
footer = self._get_query_footer()
659655

@@ -698,7 +694,7 @@ def query_region_async(self, coordinates, radius=2*u.arcmin,
698694
timeout=self.TIMEOUT, cache=cache)
699695
return response
700696

701-
def query_catalog(self, catalog, verbose=False, cache=True,
697+
def query_catalog(self, catalog, *, verbose=False, cache=True,
702698
get_query_payload=False):
703699
"""
704700
Queries a whole catalog.
@@ -727,7 +723,7 @@ def query_catalog(self, catalog, verbose=False, cache=True,
727723
return self._parse_result(response, SimbadVOTableResult,
728724
verbose=verbose)
729725

730-
def query_catalog_async(self, catalog, cache=True, get_query_payload=False):
726+
def query_catalog_async(self, catalog, *, cache=True, get_query_payload=False):
731727
"""
732728
Serves the same function as `query_catalog`, but
733729
only collects the response from the Simbad server and returns.
@@ -755,7 +751,7 @@ def query_catalog_async(self, catalog, cache=True, get_query_payload=False):
755751
timeout=self.TIMEOUT, cache=cache)
756752
return response
757753

758-
def query_bibobj(self, bibcode, verbose=False, get_query_payload=False):
754+
def query_bibobj(self, bibcode, *, verbose=False, get_query_payload=False):
759755
"""
760756
Query all the objects that are contained in the article specified by
761757
the bibcode, and return results as a `~astropy.table.Table`.
@@ -781,7 +777,7 @@ def query_bibobj(self, bibcode, verbose=False, get_query_payload=False):
781777
return self._parse_result(response, SimbadVOTableResult,
782778
verbose=verbose)
783779

784-
def query_bibobj_async(self, bibcode, cache=True, get_query_payload=False):
780+
def query_bibobj_async(self, bibcode, *, cache=True, get_query_payload=False):
785781
"""
786782
Serves the same function as `query_bibobj`, but only collects the
787783
response from the Simbad server and returns.
@@ -809,7 +805,7 @@ def query_bibobj_async(self, bibcode, cache=True, get_query_payload=False):
809805
timeout=self.TIMEOUT, cache=cache)
810806
return response
811807

812-
def query_bibcode(self, bibcode, wildcard=False, verbose=False,
808+
def query_bibcode(self, bibcode, *, wildcard=False, verbose=False,
813809
cache=True, get_query_payload=False):
814810
"""
815811
Queries the references corresponding to a given bibcode, and returns
@@ -843,7 +839,7 @@ def query_bibcode(self, bibcode, wildcard=False, verbose=False,
843839
return self._parse_result(response, SimbadBibcodeResult,
844840
verbose=verbose)
845841

846-
def query_bibcode_async(self, bibcode, wildcard=False, cache=True,
842+
def query_bibcode_async(self, bibcode, *, wildcard=False, cache=True,
847843
get_query_payload=False):
848844
"""
849845
Serves the same function as `query_bibcode`, but
@@ -878,7 +874,7 @@ def query_bibcode_async(self, bibcode, wildcard=False, cache=True,
878874

879875
return response
880876

881-
def query_objectids(self, object_name, verbose=False, cache=True,
877+
def query_objectids(self, object_name, *, verbose=False, cache=True,
882878
get_query_payload=False):
883879
"""
884880
Query Simbad with an object name, and return a table of all
@@ -906,7 +902,7 @@ def query_objectids(self, object_name, verbose=False, cache=True,
906902
return self._parse_result(response, SimbadObjectIDsResult,
907903
verbose=verbose)
908904

909-
def query_objectids_async(self, object_name, cache=True,
905+
def query_objectids_async(self, object_name, *, cache=True,
910906
get_query_payload=False):
911907
"""
912908
Serves the same function as `query_objectids`, but

0 commit comments

Comments
 (0)