Skip to content

Commit baf5d1f

Browse files
committed
move ROW_LIMIT to a more general location
1 parent 9c27da6 commit baf5d1f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

astroquery/simbad/core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,11 @@ def _get_query_header(self, get_raw=False):
938938
# if get_raw is set then don't fetch as votable
939939
if get_raw:
940940
return ""
941-
return "votable {" + ','.join(self.get_votable_fields()) + "}\nvotable open"
941+
if self.ROW_LIMIT > 0:
942+
RL = "set limit " + str(self.ROW_LIMIT) + "\n"
943+
else:
944+
RL = ""
945+
return RL+"votable {" + ','.join(self.get_votable_fields()) + "}\nvotable open"
942946

943947
def _get_query_footer(self, get_raw=False):
944948
return "" if get_raw else "votable close"
@@ -960,8 +964,6 @@ def _args_to_payload(self, *args, **kwargs):
960964
votable_header = self._get_query_header(get_raw)
961965
votable_footer = self._get_query_footer(get_raw)
962966

963-
if self.ROW_LIMIT > 0:
964-
script = "set limit " + str(self.ROW_LIMIT)
965967
script = "\n".join([script, votable_header, command])
966968
using_wildcard = False
967969
if kwargs.get('wildcard'):

astroquery/simbad/tests/test_simbad_remote.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def test_query_region_async(self, temp_dir):
101101
simbad = Simbad()
102102
# TODO: rewise once ROW_LIMIT is working
103103
simbad.TIMEOUT = 100
104+
simbad.ROW_LIMIT = 100
104105
simbad.cache_location = temp_dir
105106
response = simbad.query_region_async(
106107
ICRS_COORDS_M42, radius=2 * u.deg, equinox=2000.0, epoch='J2000')

0 commit comments

Comments
 (0)