Skip to content

Commit 351e72b

Browse files
authored
Merge pull request #1890 from tinumide/issue-1572 [nodeploy]
change single letter internal variables #1572
2 parents c4dde9d + 8d1fcc4 commit 351e72b

File tree

6 files changed

+35
-35
lines changed

6 files changed

+35
-35
lines changed

astroquery/sdss/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,10 @@ def get_spectra_async(self, coordinates=None, radius=2. * u.arcsec,
564564
return request_payload
565565

566566
url = self._get_query_url(data_release)
567-
r = self._request("GET", url, params=request_payload,
567+
result = self._request("GET", url, params=request_payload,
568568
timeout=timeout, cache=cache)
569569

570-
matches = self._parse_result(r)
570+
matches = self._parse_result(result)
571571
if matches is None:
572572
warnings.warn("Query returned no results.", NoResultsWarning)
573573
return
@@ -720,9 +720,9 @@ def get_images_async(self, coordinates=None, radius=2. * u.arcsec,
720720
return request_payload
721721

722722
url = self._get_query_url(data_release)
723-
r = self._request("GET", url, params=request_payload,
723+
result = self._request("GET", url, params=request_payload,
724724
timeout=timeout, cache=cache)
725-
matches = self._parse_result(r)
725+
matches = self._parse_result(result)
726726
if matches is None:
727727
warnings.warn("Query returned no results.", NoResultsWarning)
728728
return

astroquery/sdss/tests/test_sdss.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def get_readable_fileobj_mockreturn(filename, **kwargs):
7878
def patch_get_readable_fileobj_slow(request):
7979
@contextmanager
8080
def get_readable_fileobj_mockreturn(filename, **kwargs):
81-
e = six.moves.urllib_error.URLError('timeout')
82-
e.reason = socket.timeout()
83-
raise e
81+
error = six.moves.urllib_error.URLError('timeout')
82+
error.reason = socket.timeout()
83+
raise error
8484
yield True
8585
try:
8686
mp = request.getfixturevalue("monkeypatch")

astroquery/sha/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def parse_line(line, cs=cs):
144144
dtypes = _map_dtypes(type_names, field_widths)
145145
# To table
146146
# transpose data for appropriate table instance handling
147-
t = Table(list(zip(*data)), names=col_names, dtype=dtypes)
148-
return t
147+
table = Table(list(zip(*data)), names=col_names, dtype=dtypes)
148+
return table
149149

150150

151151
def save_file(url, out_dir='sha_tmp/', out_name=None):

astroquery/simbad/core.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828

2929
def validate_epoch(value):
30-
p = re.compile(r'^[JB]\d+[.]?\d+$', re.IGNORECASE)
31-
if p.match(value) is None:
30+
pattern = re.compile(r'^[JB]\d+[.]?\d+$', re.IGNORECASE)
31+
if pattern.match(value) is None:
3232
raise ValueError("Epoch must be specified as [J|B]<epoch>.\n"
3333
"Example: epoch='J2000'")
3434
return value
@@ -67,7 +67,7 @@ def wrapper(*args, **kwargs):
6767
return wrapper
6868

6969

70-
def strip_field(f, keep_filters=False):
70+
def strip_field(field, keep_filters=False):
7171
"""Helper tool: remove parameters from VOTABLE fields
7272
However, this should only be applied to a subset of VOTABLE fields:
7373
@@ -80,14 +80,14 @@ def strip_field(f, keep_filters=False):
8080
8181
*if* keep_filters is specified
8282
"""
83-
if '(' in f:
84-
root = f[:f.find('(')]
83+
if '(' in field:
84+
root = field[:field.find('(')]
8585
if (root in ('ra', 'dec', 'otype', 'id', 'coo', 'bibcodelist') or
8686
not keep_filters):
8787
return root
8888

8989
# the overall else (default option)
90-
return f
90+
return field
9191

9292

9393
error_regex = re.compile(r'(?ms)\[(?P<line>\d+)\]\s?(?P<msg>.+?)(\[|\Z)')
@@ -1068,10 +1068,10 @@ def _parse_result(self, result, resultclass=SimbadVOTableResult,
10681068

10691069
def _parse_coordinates(coordinates):
10701070
try:
1071-
c = commons.parse_coordinates(coordinates)
1071+
coordinates = commons.parse_coordinates(coordinates)
10721072
# now c has some subclass of astropy.coordinate
10731073
# get ra, dec and frame
1074-
return _get_frame_coords(c)
1074+
return _get_frame_coords(coordinates)
10751075
except (u.UnitsError, TypeError):
10761076
raise ValueError("Coordinates not specified correctly")
10771077

@@ -1085,29 +1085,29 @@ def _has_length(x):
10851085
return False
10861086

10871087

1088-
def _get_frame_coords(c):
1089-
if _has_length(c):
1088+
def _get_frame_coords(coordinates):
1089+
if _has_length(coordinates):
10901090
# deal with vectors differently
1091-
parsed = [_get_frame_coords(cc) for cc in c]
1091+
parsed = [_get_frame_coords(cc) for cc in coordinates]
10921092
return ([ra for ra, dec, frame in parsed],
10931093
[dec for ra, dec, frame in parsed],
10941094
[frame for ra, dec, frame in parsed])
1095-
if c.frame.name == 'icrs':
1096-
ra, dec = _to_simbad_format(c.ra, c.dec)
1095+
if coordinates.frame.name == 'icrs':
1096+
ra, dec = _to_simbad_format(coordinates.ra, coordinates.dec)
10971097
return (ra, dec, 'ICRS')
1098-
elif c.frame.name == 'galactic':
1099-
lon, lat = (str(c.l.degree), str(c.b.degree))
1098+
elif coordinates.frame.name == 'galactic':
1099+
lon, lat = (str(coordinates.l.degree), str(coordinates.b.degree))
11001100
if lat[0] not in ['+', '-']:
11011101
lat = '+' + lat
11021102
return (lon, lat, 'GAL')
1103-
elif c.frame.name == 'fk4':
1104-
ra, dec = _to_simbad_format(c.ra, c.dec)
1103+
elif coordinates.frame.name == 'fk4':
1104+
ra, dec = _to_simbad_format(coordinates.ra, coordinates.dec)
11051105
return (ra, dec, 'FK4')
1106-
elif c.frame.name == 'fk5':
1107-
ra, dec = _to_simbad_format(c.ra, c.dec)
1106+
elif coordinates.frame.name == 'fk5':
1107+
ra, dec = _to_simbad_format(coordinates.ra, coordinates.dec)
11081108
return (ra, dec, 'FK5')
11091109
else:
1110-
raise ValueError("%s is not a valid coordinate" % c)
1110+
raise ValueError("%s is not a valid coordinate" % coordinates)
11111111

11121112

11131113
def _to_simbad_format(ra, dec):

astroquery/simbad/tests/test_simbad.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ def test_get_frame_coordinates(coordinates, expected_frame):
113113
actual_frame = simbad.core._get_frame_coords(coordinates)[2]
114114
assert actual_frame == expected_frame
115115
if actual_frame == 'GAL':
116-
l, b = simbad.core._get_frame_coords(coordinates)[:2]
117-
np.testing.assert_almost_equal(float(l) % 360, -67.02084 % 360)
118-
np.testing.assert_almost_equal(float(b), -29.75447)
116+
l_gal, b_gal = simbad.core._get_frame_coords(coordinates)[:2]
117+
np.testing.assert_almost_equal(float(l_gal) % 360, -67.02084 % 360)
118+
np.testing.assert_almost_equal(float(b_gal), -29.75447)
119119

120120

121121
def test_parse_result():

astroquery/splatalogue/load_species_table.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ def species_lookuptable(filename='splat-species.json', recache=False):
6666
# check to see if the file exists; if not, we run the
6767
# scraping routine
6868
if recache or not os.path.isfile(file_cache):
69-
J = get_json_species_ids(filename)
69+
species = get_json_species_ids(filename)
7070
else:
7171
with open(data_path(filename), 'r') as f:
72-
J = json.load(f)
73-
lookuptable = SpeciesLookuptable(dict((v, k) for d in J.values()
72+
species = json.load(f)
73+
lookuptable = SpeciesLookuptable(dict((v, k) for d in species.values()
7474
for k, v in d.items()))
7575

7676
return lookuptable

0 commit comments

Comments
 (0)