@@ -56,7 +56,7 @@ class ObservationsClass(MastQueryWithLogin):
56
56
_caom_filtered = 'Mast.Caom.Filtered'
57
57
_caom_products = 'Mast.Caom.Products'
58
58
59
- def _parse_result (self , responses , verbose = False ): # Used by the async_to_sync decorator functionality
59
+ def _parse_result (self , responses , * , verbose = False ): # Used by the async_to_sync decorator functionality
60
60
"""
61
61
Parse the results of a list of `~requests.Response` objects and returns an `~astropy.table.Table` of results.
62
62
@@ -179,7 +179,7 @@ def _parse_caom_criteria(self, **criteria):
179
179
return position , mashup_filters
180
180
181
181
@class_or_instance
182
- def query_region_async (self , coordinates , radius = 0.2 * u .deg , pagesize = None , page = None ):
182
+ def query_region_async (self , coordinates , * , radius = 0.2 * u .deg , pagesize = None , page = None ):
183
183
"""
184
184
Given a sky position and radius, returns a list of MAST observations.
185
185
See column documentation `here <https://mast.stsci.edu/api/v0/_c_a_o_mfields.html>`__.
@@ -219,10 +219,10 @@ def query_region_async(self, coordinates, radius=0.2*u.deg, pagesize=None, page=
219
219
'dec' : coordinates .dec .deg ,
220
220
'radius' : radius .deg }
221
221
222
- return self ._portal_api_connection .service_request_async (service , params , pagesize , page )
222
+ return self ._portal_api_connection .service_request_async (service , params , pagesize = pagesize , page = page )
223
223
224
224
@class_or_instance
225
- def query_object_async (self , objectname , radius = 0.2 * u .deg , pagesize = None , page = None ):
225
+ def query_object_async (self , objectname , * , radius = 0.2 * u .deg , pagesize = None , page = None ):
226
226
"""
227
227
Given an object name, returns a list of MAST observations.
228
228
See column documentation `here <https://mast.stsci.edu/api/v0/_c_a_o_mfields.html>`__.
@@ -252,10 +252,10 @@ def query_object_async(self, objectname, radius=0.2*u.deg, pagesize=None, page=N
252
252
253
253
coordinates = utils .resolve_object (objectname )
254
254
255
- return self .query_region_async (coordinates , radius , pagesize , page )
255
+ return self .query_region_async (coordinates , radius = radius , pagesize = pagesize , page = page )
256
256
257
257
@class_or_instance
258
- def query_criteria_async (self , pagesize = None , page = None , ** criteria ):
258
+ def query_criteria_async (self , * , pagesize = None , page = None , ** criteria ):
259
259
"""
260
260
Given an set of criteria, returns a list of MAST observations.
261
261
Valid criteria are returned by ``get_metadata("observations")``
@@ -302,7 +302,7 @@ def query_criteria_async(self, pagesize=None, page=None, **criteria):
302
302
303
303
return self ._portal_api_connection .service_request_async (service , params )
304
304
305
- def query_region_count (self , coordinates , radius = 0.2 * u .deg , pagesize = None , page = None ):
305
+ def query_region_count (self , coordinates , * , radius = 0.2 * u .deg , pagesize = None , page = None ):
306
306
"""
307
307
Given a sky position and radius, returns the number of MAST observations in that region.
308
308
@@ -343,7 +343,7 @@ def query_region_count(self, coordinates, radius=0.2*u.deg, pagesize=None, page=
343
343
344
344
return int (self ._portal_api_connection .service_request (service , params , pagesize , page )[0 ][0 ])
345
345
346
- def query_object_count (self , objectname , radius = 0.2 * u .deg , pagesize = None , page = None ):
346
+ def query_object_count (self , objectname , * , radius = 0.2 * u .deg , pagesize = None , page = None ):
347
347
"""
348
348
Given an object name, returns the number of MAST observations.
349
349
@@ -369,9 +369,9 @@ def query_object_count(self, objectname, radius=0.2*u.deg, pagesize=None, page=N
369
369
370
370
coordinates = utils .resolve_object (objectname )
371
371
372
- return self .query_region_count (coordinates , radius , pagesize , page )
372
+ return self .query_region_count (coordinates , radius = radius , pagesize = pagesize , page = page )
373
373
374
- def query_criteria_count (self , pagesize = None , page = None , ** criteria ):
374
+ def query_criteria_count (self , * , pagesize = None , page = None , ** criteria ):
375
375
"""
376
376
Given an set of filters, returns the number of MAST observations meeting those criteria.
377
377
@@ -450,7 +450,7 @@ def get_product_list_async(self, observations):
450
450
451
451
return self ._portal_api_connection .service_request_async (service , params )
452
452
453
- def filter_products (self , products , mrp_only = False , extension = None , ** filters ):
453
+ def filter_products (self , products , * , mrp_only = False , extension = None , ** filters ):
454
454
"""
455
455
Takes an `~astropy.table.Table` of MAST observation data products and filters it based on given filters.
456
456
@@ -505,7 +505,7 @@ def filter_products(self, products, mrp_only=False, extension=None, **filters):
505
505
506
506
return products [np .where (filter_mask )]
507
507
508
- def download_file (self , uri , local_path = None , base_url = None , cache = True , cloud_only = False ):
508
+ def download_file (self , uri , * , local_path = None , base_url = None , cache = True , cloud_only = False ):
509
509
"""
510
510
Downloads a single file based on the data URI
511
511
@@ -582,7 +582,7 @@ def download_file(self, uri, local_path=None, base_url=None, cache=True, cloud_o
582
582
583
583
return status , msg , url
584
584
585
- def _download_files (self , products , base_dir , cache = True , cloud_only = False ,):
585
+ def _download_files (self , products , base_dir , * , cache = True , cloud_only = False ,):
586
586
"""
587
587
Takes an `~astropy.table.Table` of data products and downloads them into the directory given by base_dir.
588
588
@@ -658,7 +658,7 @@ def _download_curl_script(self, products, out_dir):
658
658
'Message' : [msg ]})
659
659
return manifest
660
660
661
- def download_products (self , products , download_dir = None ,
661
+ def download_products (self , products , * , download_dir = None ,
662
662
cache = True , curl_flag = False , mrp_only = False , cloud_only = False , ** filters ):
663
663
"""
664
664
Download data products.
@@ -715,7 +715,7 @@ def download_products(self, products, download_dir=None,
715
715
products = vstack (product_lists )
716
716
717
717
# apply filters
718
- products = self .filter_products (products , mrp_only , ** filters )
718
+ products = self .filter_products (products , mrp_only = mrp_only , ** filters )
719
719
720
720
if not len (products ):
721
721
warnings .warn ("No products to download." , NoResultsWarning )
@@ -726,15 +726,19 @@ def download_products(self, products, download_dir=None,
726
726
download_dir = '.'
727
727
728
728
if curl_flag : # don't want to download the files now, just the curl script
729
- manifest = self ._download_curl_script (products , download_dir )
729
+ manifest = self ._download_curl_script (products ,
730
+ download_dir )
730
731
731
732
else :
732
733
base_dir = download_dir .rstrip ('/' ) + "/mastDownload"
733
- manifest = self ._download_files (products , base_dir , cache , cloud_only )
734
+ manifest = self ._download_files (products ,
735
+ base_dir = base_dir ,
736
+ cache = cache ,
737
+ cloud_only = cloud_only )
734
738
735
739
return manifest
736
740
737
- def get_cloud_uris (self , data_products , include_bucket = True , full_url = False ):
741
+ def get_cloud_uris (self , data_products , * , include_bucket = True , full_url = False ):
738
742
"""
739
743
Takes an `~astropy.table.Table` of data products and returns the associated cloud data uris.
740
744
@@ -763,7 +767,7 @@ def get_cloud_uris(self, data_products, include_bucket=True, full_url=False):
763
767
764
768
return self ._cloud_connection .get_cloud_uri_list (data_products , include_bucket , full_url )
765
769
766
- def get_cloud_uri (self , data_product , include_bucket = True , full_url = False ):
770
+ def get_cloud_uri (self , data_product , * , include_bucket = True , full_url = False ):
767
771
"""
768
772
For a given data product, returns the associated cloud URI.
769
773
If the product is from a mission that does not support cloud access an
@@ -806,7 +810,7 @@ class MastClass(MastQueryWithLogin):
806
810
more flexible but less user friendly than `ObservationsClass`.
807
811
"""
808
812
809
- def _parse_result (self , responses , verbose = False ): # Used by the async_to_sync decorator functionality
813
+ def _parse_result (self , responses , * , verbose = False ): # Used by the async_to_sync decorator functionality
810
814
"""
811
815
Parse the results of a list of `~requests.Response` objects and returns an `~astropy.table.Table` of results.
812
816
@@ -827,7 +831,7 @@ def _parse_result(self, responses, verbose=False): # Used by the async_to_sync
827
831
return self ._portal_api_connection ._parse_result (responses , verbose )
828
832
829
833
@class_or_instance
830
- def service_request_async (self , service , params , pagesize = None , page = None , ** kwargs ):
834
+ def service_request_async (self , service , params , * , pagesize = None , page = None , ** kwargs ):
831
835
"""
832
836
Given a Mashup service and parameters, builds and excecutes a Mashup query.
833
837
See documentation `here <https://mast.stsci.edu/api/v0/class_mashup_1_1_mashup_request.html>`__
0 commit comments