Skip to content

Commit cfef4e2

Browse files
jaymedinaburnout87
authored andcommitted
adding underscores to hidden class attributes not intended for external use
1 parent 4bb8d70 commit cfef4e2

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

astroquery/mast/observations.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ class ObservationsClass(MastQueryWithLogin):
5050
"""
5151

5252
# Calling static class variables
53-
caom_all = 'Mast.Caom.All'
54-
caom_cone = 'Mast.Caom.Cone'
55-
caom_filtered_position = 'Mast.Caom.Filtered.Position'
56-
caom_filtered = 'Mast.Caom.Filtered'
57-
caom_products = 'Mast.Caom.Products'
53+
_caom_all = 'Mast.Caom.All'
54+
_caom_cone = 'Mast.Caom.Cone'
55+
_caom_filtered_position = 'Mast.Caom.Filtered.Position'
56+
_caom_filtered = 'Mast.Caom.Filtered'
57+
_caom_products = 'Mast.Caom.Products'
5858

5959
def _parse_result(self, responses, verbose=False): # Used by the async_to_sync decorator functionality
6060
"""
@@ -87,7 +87,7 @@ def list_missions(self):
8787
"""
8888

8989
# getting all the histogram information
90-
service = self.caom_all
90+
service = self._caom_all
9191
params = {}
9292
response = self._portal_api_connection.service_request_async(service, params, format='extjs')
9393
json_response = response[0].json()
@@ -117,9 +117,9 @@ def get_metadata(self, query_type):
117117
"""
118118

119119
if query_type.lower() == "observations":
120-
colconf_name = self.caom_cone
120+
colconf_name = self._caom_cone
121121
elif query_type.lower() == "products":
122-
colconf_name = self.caom_products
122+
colconf_name = self._caom_products
123123
else:
124124
raise InvalidQueryError("Unknown query type.")
125125

@@ -157,13 +157,13 @@ def _parse_caom_criteria(self, **criteria):
157157

158158
# Build the mashup filter object and store it in the correct service_name entry
159159
if coordinates or objectname:
160-
mashup_filters = self._portal_api_connection.build_filter_set(self.caom_cone,
161-
self.caom_filtered_position,
160+
mashup_filters = self._portal_api_connection.build_filter_set(self._caom_cone,
161+
self._caom_filtered_position,
162162
**criteria)
163163
coordinates = utils.parse_input_location(coordinates, objectname)
164164
else:
165-
mashup_filters = self._portal_api_connection.build_filter_set(self.caom_cone,
166-
self.caom_filtered,
165+
mashup_filters = self._portal_api_connection.build_filter_set(self._caom_cone,
166+
self._caom_filtered,
167167
**criteria)
168168

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

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

293293
if position:
294-
service = self.caom_filtered_position
294+
service = self._caom_filtered_position
295295
params = {"columns": "*",
296296
"filters": mashup_filters,
297297
"position": position}
298298
else:
299-
service = self.caom_filtered
299+
service = self._caom_filtered
300300
params = {"columns": "*",
301301
"filters": mashup_filters}
302302

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

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

405405
# send query
406406
if position:
407-
service = self.caom_filtered_position
407+
service = self._caom_filtered_position
408408
params = {"columns": "COUNT_BIG(*)",
409409
"filters": mashup_filters,
410410
"position": position}
411411
else:
412-
service = self.caom_filtered
412+
service = self._caom_filtered
413413
params = {"columns": "COUNT_BIG(*)",
414414
"filters": mashup_filters}
415415

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

448-
service = self.caom_products
448+
service = self._caom_products
449449
params = {'obsid': ','.join(observations)}
450450

451451
return self._portal_api_connection.service_request_async(service, params)

astroquery/mast/services.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ def service_request_async(self, service, params, page_size=None, page=None, **kw
249249
compiled_service_args[service_argument] = found_argument.lower()
250250

251251
request_url = self.REQUEST_URL + service_url.format(**compiled_service_args)
252+
252253
headers = {
253254
'User-Agent': self._session.headers['User-Agent'],
254255
'Content-type': 'application/x-www-form-urlencoded',

0 commit comments

Comments
 (0)