Skip to content

Commit 86a6702

Browse files
committed
MAINT: fix new linter issues
1 parent 72cb9dc commit 86a6702

File tree

6 files changed

+58
-32
lines changed

6 files changed

+58
-32
lines changed

astroquery/jplhorizons/tests/test_jplhorizons.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -257,20 +257,20 @@ def test_vectors_query_payload():
257257
epochs=2451544.5).vectors(
258258
get_query_payload=True)
259259
assert res == OrderedDict([
260-
('format', 'text'),
261-
('EPHEM_TYPE', 'VECTORS'),
262-
('OUT_UNITS', 'AU-D'),
263-
('COMMAND', '"Ceres"'),
264-
('CSV_FORMAT', '"YES"'),
265-
('REF_PLANE', 'ECLIPTIC'),
266-
('REF_SYSTEM', 'ICRF'),
267-
('TP_TYPE', 'ABSOLUTE'),
268-
('VEC_LABELS', 'YES'),
269-
('VEC_CORR', '"NONE"'),
270-
('VEC_DELTA_T', 'NO'),
271-
('OBJ_DATA', 'YES'),
272-
('CENTER', "'500@10'"),
273-
('TLIST', '2451544.5')])
260+
('format', 'text'),
261+
('EPHEM_TYPE', 'VECTORS'),
262+
('OUT_UNITS', 'AU-D'),
263+
('COMMAND', '"Ceres"'),
264+
('CSV_FORMAT', '"YES"'),
265+
('REF_PLANE', 'ECLIPTIC'),
266+
('REF_SYSTEM', 'ICRF'),
267+
('TP_TYPE', 'ABSOLUTE'),
268+
('VEC_LABELS', 'YES'),
269+
('VEC_CORR', '"NONE"'),
270+
('VEC_DELTA_T', 'NO'),
271+
('OBJ_DATA', 'YES'),
272+
('CENTER', "'500@10'"),
273+
('TLIST', '2451544.5')])
274274

275275

276276
def test_no_H(patch_request):

astroquery/mast/cutouts.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ def download_cutouts(self, *, coordinates=None, size=5, sector=None, path=".", i
309309
localpath_table['Local Path'] = [zipfile_path]
310310
return localpath_table
311311

312-
if verbose: print("Inflating...")
312+
if verbose:
313+
print("Inflating...")
314+
313315
# unzipping the zipfile
314316
zip_ref = zipfile.ZipFile(zipfile_path, 'r')
315317
cutout_files = zip_ref.namelist()
@@ -573,7 +575,9 @@ def download_cutouts(self, coordinates, *, size=5, survey=None, cutout_format="f
573575
localpath_table['Local Path'] = [zipfile_path]
574576
return localpath_table
575577

576-
if verbose: print("Inflating...")
578+
if verbose:
579+
print("Inflating...")
580+
577581
# unzipping the zipfile
578582
zip_ref = zipfile.ZipFile(zipfile_path, 'r')
579583
cutout_files = zip_ref.namelist()
@@ -731,7 +735,9 @@ def download_cutouts(self, coordinates, *, size=5, path=".", inflate=True, verbo
731735
localpath_table['Local Path'] = [zipfile_path]
732736
return localpath_table
733737

734-
if verbose: print("Inflating...")
738+
if verbose:
739+
print("Inflating...")
740+
735741
# unzipping the zipfile
736742
zip_ref = zipfile.ZipFile(zipfile_path, 'r')
737743
cutout_files = zip_ref.namelist()
@@ -742,7 +748,6 @@ def download_cutouts(self, coordinates, *, size=5, path=".", inflate=True, verbo
742748
localpath_table['Local Path'] = [path+x for x in cutout_files]
743749
return localpath_table
744750

745-
746751
def get_cutouts(self, coordinates, *, size=5):
747752
"""
748753
Get cutout image(s) around the given coordinates with indicated size,

astroquery/mast/tests/test_mast_remote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ def test_zcut_get_cutouts(self):
11051105
###################
11061106

11071107
def test_hapcut_download_cutouts(self, tmpdir):
1108-
1108+
11091109
# Test 1: Simple API call with expected results
11101110
coord = SkyCoord(351.347812, 28.497808, unit="deg")
11111111

@@ -1171,4 +1171,4 @@ def test_hapcut_get_cutouts(self):
11711171
with pytest.warns(NoResultsWarning, match='Missing HAP files for input target. Cutout not performed.'):
11721172
cutout_list = mast.Hapcut.get_cutouts(coordinates=bad_coord)
11731173
assert isinstance(cutout_list, list)
1174-
assert len(cutout_list) == 0
1174+
assert len(cutout_list) == 0

astroquery/solarsystem/pds/core.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __str__(self):
8787
return "PDSRingNode instance"
8888

8989
def ephemeris_async(self, planet, *, epoch=None, location=None, neptune_arcmodel=3,
90-
get_query_payload=False, cache=True):
90+
get_query_payload=False, cache=True):
9191
"""
9292
send query to Planetary Ring Node server
9393
@@ -182,9 +182,8 @@ def ephemeris_async(self, planet, *, epoch=None, location=None, neptune_arcmodel
182182
altitude = u.Quantity(location[2]).to_value(u.m)
183183

184184
if neptune_arcmodel not in [1, 2, 3]:
185-
raise ValueError(
186-
f"Illegal Neptune arc model {neptune_arcmodel}. must be one of 1, 2, or 3 (see https://pds-rings.seti.org/tools/viewer3_nep.shtml for details)"
187-
)
185+
raise ValueError(f"illegal Neptune arc model {neptune_arcmodel}. must be one of 1, 2, or 3 "
186+
"(see https://pds-rings.seti.org/tools/viewer3_nep.shtml for details).")
188187

189188
# configure request_payload for ephemeris query
190189
request_payload = dict(
@@ -284,7 +283,9 @@ def _parse_result(self, response, verbose=None):
284283
elif group.startswith("Sub-"):
285284

286285
group = os.linesep.join(group.splitlines()[2:]) # removing two-row header entirely
287-
bodytable2_names = ("NAIF ID", "Body", "sub_obs_lon", "sub_obs_lat", "sub_sun_lon", "sub_sun_lat", "phase", "distance")
286+
bodytable2_names = ("NAIF ID", "Body",
287+
"sub_obs_lon", "sub_obs_lat", "sub_sun_lon", "sub_sun_lat",
288+
"phase", "distance")
288289
bodytable2_units = [None, None, u.deg, u.deg, u.deg, u.deg, u.deg, u.km * 1e6]
289290
bodytable2 = QTable.read(group, format="ascii.fixed_width",
290291
col_starts=(0, 4, 18, 28, 37, 49, 57, 71),

astroquery/solarsystem/pds/tests/test_pds.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ def test_ephemeris_query_Uranus(patch_request):
6767
assert isinstance(systemtable, dict)
6868

6969
assert np.allclose(
70-
[-56.12233, -56.13586, -56.13586, -56.01577, 0.10924, 354.11072, 354.12204, 2947896667.0, 3098568884.0, 10335.713263, ],
71-
[systemtable["sub_sun_lat"].to(u.deg).value, systemtable["sub_sun_lat_min"].to(u.deg).value, systemtable["sub_sun_lat_max"].to(u.deg).value, systemtable["opening_angle"].to(u.deg).value, systemtable["phase_angle"].to(u.deg).value, systemtable["sub_sun_lon"].to(u.deg).value, systemtable["sub_obs_lon"].to(u.deg).value, systemtable["d_sun"].to(u.km).value, systemtable["d_obs"].to(u.km).value, systemtable["light_time"].to(u.second).value, ],
70+
[-56.12233, -56.13586, -56.13586, -56.01577, 0.10924,
71+
354.11072, 354.12204, 2947896667.0, 3098568884.0, 10335.713263, ],
72+
[systemtable["sub_sun_lat"].to(u.deg).value, systemtable["sub_sun_lat_min"].to(u.deg).value,
73+
systemtable["sub_sun_lat_max"].to(u.deg).value, systemtable["opening_angle"].to(u.deg).value,
74+
systemtable["phase_angle"].to(u.deg).value, systemtable["sub_sun_lon"].to(u.deg).value,
75+
systemtable["sub_obs_lon"].to(u.deg).value, systemtable["d_sun"].to(u.km).value,
76+
systemtable["d_obs"].to(u.km).value, systemtable["light_time"].to(u.second).value, ],
7277
rtol=1e-2,
7378
)
7479

@@ -104,7 +109,11 @@ def test_ephemeris_query_Pluto(patch_request):
104109
# check system table
105110
assert np.allclose(
106111
[57.57737, 57.56961, 57.56961, 56.50534, 1.64048, 116.55873, 118.8369, 5142696000, 5114486810, 17060.091666, ],
107-
[systemtable["sub_sun_lat"].to(u.deg).value, systemtable["sub_sun_lat_min"].to(u.deg).value, systemtable["sub_sun_lat_max"].to(u.deg).value, systemtable["opening_angle"].to(u.deg).value, systemtable["phase_angle"].to(u.deg).value, systemtable["sub_sun_lon"].to(u.deg).value, systemtable["sub_obs_lon"].to(u.deg).value, systemtable["d_sun"].to(u.km).value, systemtable["d_obs"].to(u.km).value, systemtable["light_time"].to(u.second).value, ],
112+
[systemtable["sub_sun_lat"].to(u.deg).value, systemtable["sub_sun_lat_min"].to(u.deg).value,
113+
systemtable["sub_sun_lat_max"].to(u.deg).value, systemtable["opening_angle"].to(u.deg).value,
114+
systemtable["phase_angle"].to(u.deg).value, systemtable["sub_sun_lon"].to(u.deg).value,
115+
systemtable["sub_obs_lon"].to(u.deg).value, systemtable["d_sun"].to(u.km).value,
116+
systemtable["d_obs"].to(u.km).value, systemtable["light_time"].to(u.second).value, ],
108117
rtol=1e-2,
109118
)
110119

@@ -114,7 +123,10 @@ def test_ephemeris_query_Pluto(patch_request):
114123
assert styx["Body"] == "Styx"
115124
assert np.allclose(
116125
[296.212477, -22.93533, -0.557, -1.259, 350.443, 56.472, 352.72, 57.544, 1.64047, 5114.509238, ],
117-
[styx["RA (deg)"].to(u.deg).value, styx["Dec (deg)"].to(u.deg).value, styx["dRA"].to(u.arcsec).value, styx["dDec"].to(u.arcsec).value, styx["sub_obs_lon"].to(u.deg).value, styx["sub_obs_lat"].to(u.deg).value, styx["sub_sun_lon"].to(u.deg).value, styx["sub_sun_lat"].to(u.deg).value, styx["phase"].to(u.deg).value, styx["distance"].to(u.km * 1e6).value, ],
126+
[styx["RA (deg)"].to(u.deg).value, styx["Dec (deg)"].to(u.deg).value, styx["dRA"].to(u.arcsec).value,
127+
styx["dDec"].to(u.arcsec).value, styx["sub_obs_lon"].to(u.deg).value, styx["sub_obs_lat"].to(u.deg).value,
128+
styx["sub_sun_lon"].to(u.deg).value, styx["sub_sun_lat"].to(u.deg).value, styx["phase"].to(u.deg).value,
129+
styx["distance"].to(u.km * 1e6).value, ],
118130
rtol=1e-2,
119131
)
120132

astroquery/solarsystem/pds/tests/test_pds_remote.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ def test_ephemeris_query(self):
1717
# check system table
1818
systemtable = bodytable.meta
1919
assert np.allclose(
20-
[-56.12233, -56.13586, -56.13586, -56.01577, 0.10924, 354.11072, 354.12204, 2947896667.0, 3098568884.0, 10335.713263, ],
21-
[systemtable["sub_sun_lat"].to(u.deg).value, systemtable["sub_sun_lat_min"].to(u.deg).value, systemtable["sub_sun_lat_max"].to(u.deg).value, systemtable["opening_angle"].to(u.deg).value, systemtable["phase_angle"].to(u.deg).value, systemtable["sub_sun_lon"].to(u.deg).value, systemtable["sub_obs_lon"].to(u.deg).value, systemtable["d_sun"].to(u.km).value, systemtable["d_obs"].to(u.km).value, systemtable["light_time"].to(u.second).value, ],
20+
[-56.12233, -56.13586, -56.13586, -56.01577, 0.10924, 354.11072, 354.12204,
21+
2947896667.0, 3098568884.0, 10335.713263, ],
22+
[systemtable["sub_sun_lat"].to(u.deg).value, systemtable["sub_sun_lat_min"].to(u.deg).value,
23+
systemtable["sub_sun_lat_max"].to(u.deg).value, systemtable["opening_angle"].to(u.deg).value,
24+
systemtable["phase_angle"].to(u.deg).value, systemtable["sub_sun_lon"].to(u.deg).value,
25+
systemtable["sub_obs_lon"].to(u.deg).value, systemtable["d_sun"].to(u.km).value,
26+
systemtable["d_obs"].to(u.km).value, systemtable["light_time"].to(u.second).value, ],
2227
rtol=1e-2,
2328
)
2429

@@ -28,7 +33,10 @@ def test_ephemeris_query(self):
2833
assert mab["Body"] == "Mab"
2934
assert np.allclose(
3035
[42.011201, 15.801323, 5.368, 0.623, 223.976, 55.906, 223.969, 56.013, 0.10932, 3098.514, ],
31-
[mab["RA (deg)"].to(u.deg).value, mab["Dec (deg)"].to(u.deg).value, mab["dRA"].to(u.arcsec).value, mab["dDec"].to(u.arcsec).value, mab["sub_obs_lon"].to(u.deg).value, mab["sub_obs_lat"].to(u.deg).value, mab["sub_sun_lon"].to(u.deg).value, mab["sub_sun_lat"].to(u.deg).value, mab["phase"].to(u.deg).value, mab["distance"].to(u.km * 1e6).value, ],
36+
[mab["RA (deg)"].to(u.deg).value, mab["Dec (deg)"].to(u.deg).value, mab["dRA"].to(u.arcsec).value,
37+
mab["dDec"].to(u.arcsec).value, mab["sub_obs_lon"].to(u.deg).value,
38+
mab["sub_obs_lat"].to(u.deg).value, mab["sub_sun_lon"].to(u.deg).value, mab["sub_sun_lat"].to(u.deg).value,
39+
mab["phase"].to(u.deg).value, mab["distance"].to(u.km * 1e6).value, ],
3240
rtol=1e-2,
3341
)
3442

0 commit comments

Comments
 (0)