Skip to content

Commit

Permalink
adding underscores to hidden class attributes not intended for extern…
Browse files Browse the repository at this point in the history
…al use
  • Loading branch information
jaymedina committed Jan 6, 2022
1 parent 37499aa commit de936db
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
38 changes: 19 additions & 19 deletions astroquery/mast/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class ObservationsClass(MastQueryWithLogin):
"""

# Calling static class variables
caom_all = 'Mast.Caom.All'
caom_cone = 'Mast.Caom.Cone'
caom_filtered_position = 'Mast.Caom.Filtered.Position'
caom_filtered = 'Mast.Caom.Filtered'
caom_products = 'Mast.Caom.Products'
_caom_all = 'Mast.Caom.All'
_caom_cone = 'Mast.Caom.Cone'
_caom_filtered_position = 'Mast.Caom.Filtered.Position'
_caom_filtered = 'Mast.Caom.Filtered'
_caom_products = 'Mast.Caom.Products'

def _parse_result(self, responses, verbose=False): # Used by the async_to_sync decorator functionality
"""
Expand Down Expand Up @@ -87,7 +87,7 @@ def list_missions(self):
"""

# getting all the histogram information
service = self.caom_all
service = self._caom_all
params = {}
response = self._portal_api_connection.service_request_async(service, params, format='extjs')
json_response = response[0].json()
Expand Down Expand Up @@ -117,9 +117,9 @@ def get_metadata(self, query_type):
"""

if query_type.lower() == "observations":
colconf_name = self.caom_cone
colconf_name = self._caom_cone
elif query_type.lower() == "products":
colconf_name = self.caom_products
colconf_name = self._caom_products
else:
raise InvalidQueryError("Unknown query type.")

Expand Down Expand Up @@ -157,13 +157,13 @@ def _parse_caom_criteria(self, **criteria):

# Build the mashup filter object and store it in the correct service_name entry
if coordinates or objectname:
mashup_filters = self._portal_api_connection.build_filter_set(self.caom_cone,
self.caom_filtered_position,
mashup_filters = self._portal_api_connection.build_filter_set(self._caom_cone,
self._caom_filtered_position,
**criteria)
coordinates = utils.parse_input_location(coordinates, objectname)
else:
mashup_filters = self._portal_api_connection.build_filter_set(self.caom_cone,
self.caom_filtered,
mashup_filters = self._portal_api_connection.build_filter_set(self._caom_cone,
self._caom_filtered,
**criteria)

# handle position info (if any)
Expand Down Expand Up @@ -214,7 +214,7 @@ def query_region_async(self, coordinates, radius=0.2*u.deg, pagesize=None, page=
# if radius is just a number we assume degrees
radius = coord.Angle(radius, u.deg)

service = self.caom_cone
service = self._caom_cone
params = {'ra': coordinates.ra.deg,
'dec': coordinates.dec.deg,
'radius': radius.deg}
Expand Down Expand Up @@ -291,12 +291,12 @@ def query_criteria_async(self, pagesize=None, page=None, **criteria):
raise InvalidQueryError("At least one non-positional criterion must be supplied.")

if position:
service = self.caom_filtered_position
service = self._caom_filtered_position
params = {"columns": "*",
"filters": mashup_filters,
"position": position}
else:
service = self.caom_filtered
service = self._caom_filtered
params = {"columns": "*",
"filters": mashup_filters}

Expand Down Expand Up @@ -336,7 +336,7 @@ def query_region_count(self, coordinates, radius=0.2*u.deg, pagesize=None, page=
# turn coordinates into the format
position = ', '.join([str(x) for x in (coordinates.ra.deg, coordinates.dec.deg, radius.deg)])

service = self.caom_filtered_position
service = self._caom_filtered_position
params = {"columns": "COUNT_BIG(*)",
"filters": [],
"position": position}
Expand Down Expand Up @@ -404,12 +404,12 @@ def query_criteria_count(self, pagesize=None, page=None, **criteria):

# send query
if position:
service = self.caom_filtered_position
service = self._caom_filtered_position
params = {"columns": "COUNT_BIG(*)",
"filters": mashup_filters,
"position": position}
else:
service = self.caom_filtered
service = self._caom_filtered
params = {"columns": "COUNT_BIG(*)",
"filters": mashup_filters}

Expand Down Expand Up @@ -445,7 +445,7 @@ def get_product_list_async(self, observations):
if len(observations) == 0:
raise InvalidQueryError("Observation list is empty, no associated products.")

service = self.caom_products
service = self._caom_products
params = {'obsid': ','.join(observations)}

return self._portal_api_connection.service_request_async(service, params)
Expand Down
1 change: 1 addition & 0 deletions astroquery/mast/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ def service_request_async(self, service, params, page_size=None, page=None, **kw
compiled_service_args[service_argument] = found_argument.lower()

request_url = self.REQUEST_URL + service_url.format(**compiled_service_args)

headers = {
'User-Agent': self._session.headers['User-Agent'],
'Content-type': 'application/x-www-form-urlencoded',
Expand Down

0 comments on commit de936db

Please sign in to comment.