Skip to content

Commit 2ae9491

Browse files
committed
solved pep8 issues after merge conflicts
1 parent 64d17fc commit 2ae9491

File tree

3 files changed

+17
-24
lines changed

3 files changed

+17
-24
lines changed

astroquery/esa/xmm_newton/core.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,26 @@
2020
from pathlib import Path
2121
import tarfile
2222
import os
23-
from astroquery import log
24-
import configparser
2523

2624
from astropy.io import fits
27-
from . import conf
25+
from . import conf, config
2826
from astroquery import log
2927
from astropy.coordinates import SkyCoord
3028
from ...exceptions import LoginError
3129

30+
3231
__all__ = ['XMMNewton', 'XMMNewtonClass']
3332

3433

3534
class XMMNewtonClass(BaseQuery):
35+
3636
data_url = conf.DATA_ACTION
3737
data_aio_url = conf.DATA_ACTION_AIO
3838
metadata_url = conf.METADATA_ACTION
3939
TIMEOUT = conf.TIMEOUT
4040

4141
def __init__(self, tap_handler=None):
4242
super(XMMNewtonClass, self).__init__()
43-
self.configuration = configparser.ConfigParser()
4443

4544
if tap_handler is None:
4645
self._tap = TapPlus(url="https://nxsa.esac.esa.int/tap-server/tap")
@@ -49,7 +48,7 @@ def __init__(self, tap_handler=None):
4948
self._rmf_ftp = str("http://sasdev-xmm.esac.esa.int/pub/ccf/constituents/extras/responses/")
5049

5150
def download_data(self, observation_id, *, filename=None, verbose=False,
52-
cache=True, prop=False, credentials_file=None, **kwargs):
51+
cache=True, prop=False, username=None, password=None, **kwargs):
5352
"""
5453
Download data from XMM-Newton
5554
@@ -64,13 +63,6 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
6463
verbose : bool
6564
optional, default 'False'
6665
flag to display information about the process
67-
prop: boolean
68-
optional, default 'False'
69-
flag to download proprietary data, the method will then ask the user to
70-
input their username and password either manually or using the credentials_file
71-
credentials_file: string
72-
optional, default None
73-
path to where the users config.ini file is stored with their username and password
7466
level : string
7567
level to download, optional, by default everything is downloaded
7668
values: ODF, PPS
@@ -113,7 +105,7 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
113105
reveals the url being sent which in turn reveals the users username and password
114106
"""
115107
previouslevel = log.getEffectiveLevel()
116-
log.setLevel(21)
108+
log.setLevel(50)
117109

118110
# create url to access the aio
119111
link = self._create_link(observation_id, **kwargs)
@@ -130,6 +122,7 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
130122
params = self._request_link(link, cache)
131123
r_filename = params["filename"]
132124
suffixes = Path(r_filename).suffixes
125+
print(suffixes)
133126

134127
# get desired filename
135128
filename = self._create_filename(filename, observation_id, suffixes)
@@ -306,7 +299,7 @@ def _request_link(self, link, cache):
306299
return params
307300

308301
def _get_username_and_password(self, credentials_file):
309-
if credentials_file != None:
302+
if credentials_file is not None:
310303
self.configuration.read(credentials_file)
311304
username = self.configuration.get('user', 'username')
312305
password = self.configuration.get('user', 'password')

astroquery/esa/xmm_newton/tests/test_xmm_newton.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,4 +560,4 @@ def test_create_filename_None(self):
560560
def test_create_filename_Not_None(self):
561561
xsa = XMMNewtonClass(self.get_dummy_tap_handler())
562562
filename = xsa._create_filename("Test", "0560181401", ['.tar', '.gz'])
563-
assert filename == "Test.tar.gz"
563+
assert filename == "Test.tar.gz"

astroquery/esa/xmm_newton/tests/test_xmm_newton_remote.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from ..core import XMMNewtonClass
2222
from ..tests.dummy_tap_handler import DummyXMMNewtonTapHandler
2323

24+
2425
class TestXMMNewtonRemote():
2526
_files = {
2627
"0405320501": {
@@ -78,15 +79,15 @@ class TestXMMNewtonRemote():
7879
"P0405320501PNS001IMAGE_5000.FTZ",
7980
"P0405320501PNU001IMAGE_5000.FTZ",
8081
"P0405320501PNX001IMAGE_5000.FTZ"
81-
]
82-
}
82+
]
83+
}
8384
}
8485

8586
def get_dummy_tap_handler(self):
8687
parameters = {'query': "select top 10 * from v_public_observations",
87-
'output_file': "test2.vot",
88-
'output_format': "votable",
89-
'verbose': False}
88+
'output_file': "test2.vot",
89+
'output_format': "votable",
90+
'verbose': False}
9091
dummyTapHandler = DummyXMMNewtonTapHandler("launch_job", parameters)
9192
return dummyTapHandler
9293

@@ -99,7 +100,7 @@ def _create_tar(self, tarname, files):
99100
os.makedirs(os.path.join(ob_name, ftype))
100101
except OSError as exc:
101102
if exc.errno == errno.EEXIST and \
102-
os.path.isdir(os.path.join(ob_name, ftype)):
103+
os.path.isdir(os.path.join(ob_name, ftype)):
103104
pass
104105
else:
105106
raise
@@ -164,7 +165,7 @@ def test_get_epic_metadata(self):
164165
slew_source_column = "slew_source_cat_equatorial_spoint"
165166
xsa = XMMNewtonClass(TapPlus(url=tap_url))
166167
epic_source, cat_4xmm, stack_4xmm, slew_source = xsa.get_epic_metadata(target_name=target_name,
167-
radius=radius)
168+
radius=radius)
168169
c = SkyCoord.from_name(target_name, parse=True)
169170
query = ("select * from {} "
170171
"where 1=contains({}, circle('ICRS', {}, {}, {}));")
@@ -221,7 +222,6 @@ def test_download_proprietary_data_without_credentials(self):
221222
xsa = XMMNewtonClass(self.get_dummy_tap_handler())
222223
xsa.download_data(**parameters)
223224

224-
225225
@pytest.mark.remote_data
226226
def test_get_epic_spectra(self):
227227
_tarname = "tarfile.tar"
@@ -233,4 +233,4 @@ def test_get_epic_spectra(self):
233233
xsa = XMMNewtonClass(self.get_dummy_tap_handler())
234234
res = xsa.get_epic_spectra(_tarname, _source_number,
235235
instrument=[])
236-
assert len(res) == 0
236+
assert len(res) == 0

0 commit comments

Comments
 (0)