21
21
from astropy .utils .exceptions import AstropyDeprecationWarning
22
22
from astropy .utils .decorators import deprecated
23
23
from astropy import units as u
24
+ import pyvo
25
+ from pyvo .auth import authsession
26
+
24
27
from . import conf
25
28
26
- try :
27
- import pyvo
28
- from pyvo .auth import authsession
29
- except ImportError :
30
- print ('Please install pyvo. astropy.cadc does not work without it.' )
31
- except AstropyDeprecationWarning as e :
32
- if str (e ) == 'The astropy.vo.samp module has now been moved to astropy.samp' :
33
- # CADC does not use samp and this only affects Python 2.7
34
- print ('AstropyDeprecationWarning: {}' .format (str (e )))
35
- else :
36
- raise e
37
29
38
30
__all__ = ['Cadc' , 'CadcClass' ]
39
31
@@ -78,17 +70,14 @@ class CadcClass(BaseQuery):
78
70
CADCLOGIN_SERVICE_URI = conf .CADCLOGIN_SERVICE_URI
79
71
TIMEOUT = conf .TIMEOUT
80
72
81
- def __init__ (self , url = None , tap_plus_handler = None , verbose = None ,
82
- auth_session = None ):
73
+ def __init__ (self , url = None , auth_session = None ):
83
74
"""
84
75
Initialize Cadc object
85
76
86
77
Parameters
87
78
----------
88
79
url : str, optional, default 'None;
89
80
a url to use instead of the default
90
- tap_plus_handler : deprecated
91
- verbose : deprecated
92
81
auth_session: `requests.Session` or `pyvo.auth.authsession.AuthSession`
93
82
A existing authenticated session containing the appropriate
94
83
credentials to be used by the client to communicate with the
@@ -98,10 +87,6 @@ def __init__(self, url=None, tap_plus_handler=None, verbose=None,
98
87
-------
99
88
Cadc object
100
89
"""
101
- if tap_plus_handler :
102
- raise AttributeError ('tap handler no longer supported' )
103
- if verbose is not None :
104
- warnings .warn ('verbose deprecated since version 0.4.0' )
105
90
106
91
super (CadcClass , self ).__init__ ()
107
92
self .baseurl = url
@@ -210,19 +195,12 @@ def login(self, user=None, password=None, certificate_file=None):
210
195
self .cadctap ._session .cookies .set (
211
196
CADC_COOKIE_PREFIX , cookie )
212
197
213
- def logout (self , verbose = None ):
198
+ def logout (self ):
214
199
"""
215
200
Logout. Anonymous access with all the subsequent use of the
216
201
object. Note that the original session is not affected (in case
217
202
it was passed when the object was first instantiated)
218
-
219
- Parameters
220
- ----------
221
- verbose : deprecated
222
-
223
203
"""
224
- if verbose is not None :
225
- warnings .warn ('verbose deprecated since 0.4.0' )
226
204
227
205
if isinstance (self ._auth_session , pyvo .auth .AuthSession ):
228
206
# Remove the existing credentials (if any)
@@ -561,44 +539,38 @@ def get_data_urls(self, query_result, include_auxiliaries=False):
561
539
result .append (service_def .access_url )
562
540
return result
563
541
564
- def get_tables (self , only_names = False , verbose = None ):
542
+ def get_tables (self , only_names = False ):
565
543
"""
566
544
Gets all public tables
567
545
568
546
Parameters
569
547
----------
570
548
only_names : bool, optional, default False
571
549
True to load table names only
572
- verbose : deprecated
573
550
574
551
Returns
575
552
-------
576
553
A list of table objects
577
554
"""
578
- if verbose is not None :
579
- warnings .warn ('verbose deprecated since 0.4.0' )
580
555
table_set = self .cadctap .tables
581
556
if only_names :
582
557
return list (table_set .keys ())
583
558
else :
584
559
return list (table_set .values ())
585
560
586
- def get_table (self , table , verbose = None ):
561
+ def get_table (self , table ):
587
562
"""
588
563
Gets the specified table
589
564
590
565
Parameters
591
566
----------
592
567
table : str, mandatory
593
568
full qualified table name (i.e. schema name + table name)
594
- verbose : deprecated
595
569
596
570
Returns
597
571
-------
598
572
A table object
599
573
"""
600
- if verbose is not None :
601
- warnings .warn ('verbose deprecated since 0.4.0' )
602
574
tables = self .get_tables ()
603
575
for t in tables :
604
576
if table == t .name :
@@ -683,67 +655,25 @@ def create_async(self, query, maxrec=None, uploads=None):
683
655
return self .cadctap .submit_job (query , language = 'ADQL' ,
684
656
uploads = uploads )
685
657
686
- @deprecated ('0.4.0' , 'Use exec_sync or create_async instead' )
687
- def run_query (self , query , operation , output_file = None ,
688
- output_format = "votable" , verbose = None ,
689
- background = False , upload_resource = None ,
690
- upload_table_name = None ):
691
- """
692
- Runs a query
693
-
694
- Parameters
695
- ----------
696
- query : str, mandatory
697
- query to be executed
698
- operation : str, mandatory,
699
- 'sync' or 'async' to run a synchronous or asynchronous job
700
- output_file : str, optional, default None
701
- file name where the results are saved if dumpToFile is True.
702
- If this parameter is not provided, the jobid is used instead
703
- output_format : str, optional, default 'votable'
704
- results format, 'csv', 'tsv' and 'votable'
705
- verbose : deprecated
706
- save_to_file : bool, optional, default 'False'
707
- if True, the results are saved in a file instead of using memory
708
- background : bool, optional, default 'False'
709
- when the job is executed in asynchronous mode,
710
- this flag specifies whether the execution will wait until results
711
- are available
712
- upload_resource : str, optional, default None
713
- resource to be uploaded to UPLOAD_SCHEMA
714
- upload_table_name : str, required if uploadResource is provided,
715
- default None
716
- resource temporary table name associated to the uploaded resource
717
-
718
- Returns
719
- -------
720
- A Job object
721
- """
722
- raise NotImplementedError ('No longer supported. '
723
- 'Use exec_sync or create_async instead.' )
724
-
725
- def load_async_job (self , jobid , verbose = None ):
658
+ def load_async_job (self , jobid ):
726
659
"""
727
660
Loads an asynchronous job
728
661
729
662
Parameters
730
663
----------
731
664
jobid : str, mandatory
732
665
job identifier
733
- verbose : deprecated
734
666
735
667
Returns
736
668
-------
737
669
A Job object
738
670
"""
739
- if verbose is not None :
740
- warnings .warn ('verbose deprecated since 0.4.0' )
741
671
742
672
return pyvo .dal .AsyncTAPJob ('{}/async/{}' .format (
743
673
self .cadctap .baseurl , jobid ), session = self ._auth_session )
744
674
745
675
def list_async_jobs (self , phases = None , after = None , last = None ,
746
- short_description = True , verbose = None ):
676
+ short_description = True ):
747
677
"""
748
678
Returns all the asynchronous jobs
749
679
@@ -760,14 +690,11 @@ def list_async_jobs(self, phases=None, after=None, last=None,
760
690
corresponding to the TAP ShortJobDescription object (job ID, phase,
761
691
run ID, owner ID and creation ID) whereas if False, a separate GET
762
692
call to each job is performed for the complete job description
763
- verbose : deprecated
764
693
765
694
Returns
766
695
-------
767
696
A list of Job objects
768
697
"""
769
- if verbose is not None :
770
- warnings .warn ('verbose deprecated since 0.4.0' )
771
698
772
699
return self .cadctap .get_job_list (phases = phases , after = after , last = last ,
773
700
short_description = short_description )
0 commit comments