Skip to content

Commit 062a2b5

Browse files
committed
Fix D202 - NoBlankLineAfterFunction
`ruff` will guard against violations from now on. Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
1 parent 8dfd151 commit 062a2b5

158 files changed

Lines changed: 0 additions & 919 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

astropy/config/configuration.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,6 @@ def get_config(packageormod=None, reload=False, rootname=None):
552552
If ``packageormod`` is `None`, but the package this item is created
553553
from cannot be determined.
554554
"""
555-
556555
if packageormod is None:
557556
packageormod = find_current_module(2)
558557
if packageormod is None:
@@ -773,7 +772,6 @@ def update_default_config(pkg, default_cfg_dir_or_fn, version=None, rootname="as
773772
If the version number of the package could not determined.
774773
775774
"""
776-
777775
if path.isdir(default_cfg_dir_or_fn):
778776
default_cfgfn = path.join(default_cfg_dir_or_fn, pkg + ".cfg")
779777
else:
@@ -862,7 +860,6 @@ def create_config_file(pkg, rootname="astropy", overwrite=False):
862860
If the profile was updated, `True`, otherwise `False`.
863861
864862
"""
865-
866863
# local import to prevent using the logger before it is configured
867864
from astropy.logger import log
868865

astropy/config/paths.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def get_config_dir(rootname="astropy"):
9999
The absolute path to the configuration directory.
100100
101101
"""
102-
103102
# symlink will be set to this if the directory is created
104103
linkto = None
105104

@@ -147,7 +146,6 @@ def get_cache_dir(rootname="astropy"):
147146
The absolute path to the cache directory.
148147
149148
"""
150-
151149
# symlink will be set to this if the directory is created
152150
linkto = None
153151

astropy/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def pytest_unconfigure(config):
125125

126126
def pytest_terminal_summary(terminalreporter):
127127
"""Output a warning to IPython users in case any tests failed."""
128-
129128
try:
130129
get_ipython()
131130
except NameError:

astropy/constants/constant.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,31 +195,26 @@ def abbrev(self):
195195
"""A typical ASCII text abbreviation of the constant, also generally
196196
the same as the Python variable used for this constant.
197197
"""
198-
199198
return self._abbrev
200199

201200
@property
202201
def name(self):
203202
"""The full name of the constant."""
204-
205203
return self._name
206204

207205
@lazyproperty
208206
def _unit(self):
209207
"""The unit(s) in which this constant is defined."""
210-
211208
return Unit(self._unit_string)
212209

213210
@property
214211
def uncertainty(self):
215212
"""The known absolute uncertainty in this constant's value."""
216-
217213
return self._uncertainty
218214

219215
@property
220216
def reference(self):
221217
"""The source used for the value of this constant."""
222-
223218
return self._reference
224219

225220
@property
@@ -228,7 +223,6 @@ def system(self):
228223
`None` so long as the constant's units can be directly converted
229224
between systems).
230225
"""
231-
232226
return self._system
233227

234228
def _instance_or_super(self, key):
@@ -244,15 +238,13 @@ def si(self):
244238
"""If the Constant is defined in the SI system return that instance of
245239
the constant, else convert to a Quantity in the appropriate SI units.
246240
"""
247-
248241
return self._instance_or_super("si")
249242

250243
@property
251244
def cgs(self):
252245
"""If the Constant is defined in the CGS system return that instance of
253246
the constant, else convert to a Quantity in the appropriate CGS units.
254247
"""
255-
256248
return self._instance_or_super("cgs")
257249

258250
def __array_finalize__(self, obj):
@@ -278,7 +270,6 @@ def cgs(self):
278270
"""Overridden for EMConstant to raise a `TypeError`
279271
emphasizing that there are multiple EM extensions to CGS.
280272
"""
281-
282273
raise TypeError(
283274
"Cannot convert EM constants to cgs because there "
284275
"are different systems for E.M constants within the "

astropy/convolution/convolve.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def _next_fast_lengths(shape):
5454
Calculated directly with `scipy.fft.next_fast_len`, if available; otherwise
5555
looked up from list and scaled by powers of 10, if necessary.
5656
"""
57-
5857
try:
5958
import scipy.fft
6059

@@ -214,7 +213,6 @@ def convolve(
214213
For masked arrays, masked values are treated as NaNs. The convolution
215214
is always done at ``numpy.float`` precision.
216215
"""
217-
218216
if boundary not in BOUNDARY_OPTIONS:
219217
raise ValueError(f"Invalid boundary option: must be one of {BOUNDARY_OPTIONS}")
220218

@@ -979,7 +977,6 @@ def interpolate_replace_nans(array, kernel, convolve=convolve, **kwargs):
979977
A copy of the original array with NaN pixels replaced with their
980978
interpolated counterparts
981979
"""
982-
983980
if not np.any(np.isnan(array)):
984981
return array.copy()
985982

@@ -1023,7 +1020,6 @@ def convolve_models(model, kernel, mode="convolve_fft", **kwargs):
10231020
default : `~astropy.modeling.core.CompoundModel`
10241021
Convolved model
10251022
"""
1026-
10271023
if mode == "convolve_fft":
10281024
operator = SPECIAL_OPERATORS.add(
10291025
"convolve_fft", partial(convolve_fft, **kwargs)
@@ -1065,7 +1061,6 @@ def convolve_models_fft(model, kernel, bounding_box, resolution, cache=True, **k
10651061
default : `~astropy.modeling.core.CompoundModel`
10661062
Convolved model
10671063
"""
1068-
10691064
operator = SPECIAL_OPERATORS.add("convolve_fft", partial(convolve_fft, **kwargs))
10701065

10711066
return Convolution(operator, model, kernel, bounding_box, resolution, cache)

astropy/convolution/core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def normalize(self, mode="integral"):
9898
* 'peak'
9999
Kernel is normalized such that its peak = 1.
100100
"""
101-
102101
if mode == "integral":
103102
normalization = self._array.sum()
104103
elif mode == "peak":

astropy/coordinates/angle_formats.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ def hms_to_hours(h, m, s=None):
466466
"""
467467
Convert hour, minute, second to a float hour value.
468468
"""
469-
470469
check_hms_ranges(h, m, s)
471470

472471
# determine sign
@@ -498,15 +497,13 @@ def hms_to_degrees(h, m, s):
498497
"""
499498
Convert hour, minute, second to a float degrees value.
500499
"""
501-
502500
return hms_to_hours(h, m, s) * 15.0
503501

504502

505503
def hms_to_radians(h, m, s):
506504
"""
507505
Convert hour, minute, second to a float radians value.
508506
"""
509-
510507
return u.degree.to(u.radian, hms_to_degrees(h, m, s))
511508

512509

@@ -515,7 +512,6 @@ def hms_to_dms(h, m, s):
515512
Convert degrees, arcminutes, arcseconds to an ``(hour, minute, second)``
516513
tuple.
517514
"""
518-
519515
return degrees_to_dms(hms_to_degrees(h, m, s))
520516

521517

@@ -532,7 +528,6 @@ def hours_to_radians(h):
532528
"""
533529
Convert an angle in Hours to Radians.
534530
"""
535-
536531
return u.hourangle.to(u.radian, h)
537532

538533

@@ -541,7 +536,6 @@ def hours_to_hms(h):
541536
Convert an floating-point hour value into an ``(hour, minute,
542537
second)`` tuple.
543538
"""
544-
545539
sign = np.copysign(1.0, h)
546540

547541
(hf, h) = np.modf(np.abs(h)) # (degree fraction, degree)
@@ -569,7 +563,6 @@ def radians_to_hms(r):
569563
"""
570564
Convert an angle in Radians to an ``(hour, minute, second)`` tuple.
571565
"""
572-
573566
hours = radians_to_hours(r)
574567
return hours_to_hms(hours)
575568

@@ -579,7 +572,6 @@ def radians_to_dms(r):
579572
Convert an angle in Radians to an ``(degree, arcminute,
580573
arcsecond)`` tuple.
581574
"""
582-
583575
degrees = u.radian.to(u.degree, r)
584576
return degrees_to_dms(degrees)
585577

@@ -592,7 +584,6 @@ def sexagesimal_to_string(values, precision=None, pad=False, sep=(":",), fields=
592584
See `hours_to_string` and `degrees_to_string` for a higher-level
593585
interface to this functionality.
594586
"""
595-
596587
# Check to see if values[0] is negative, using np.copysign to handle -0
597588
sign = np.copysign(1.0, values[0])
598589
# If the coordinates are negative, we need to take the absolute values.

astropy/coordinates/angle_utilities.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def angular_separation(lon1, lat1, lon2, lat2):
5151
5252
.. [1] https://en.wikipedia.org/wiki/Great-circle_distance
5353
"""
54-
5554
sdlon = np.sin(lon2 - lon1)
5655
cdlon = np.cos(lon2 - lon1)
5756
slat1 = np.sin(lat1)
@@ -201,7 +200,6 @@ def uniform_spherical_random_surface(size=1):
201200
rep : `~astropy.coordinates.UnitSphericalRepresentation`
202201
The random points.
203202
"""
204-
205203
rng = np.random # can maybe switch to this being an input later - see #11628
206204

207205
lon = rng.uniform(0, _TWOPI, size) * u.rad

astropy/coordinates/attributes.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ def convert_input(self, value):
175175
ValueError
176176
If the input is not valid for this attribute.
177177
"""
178-
179178
from astropy.time import Time
180179

181180
if value is None:
@@ -240,7 +239,6 @@ def convert_input(self, value):
240239
ValueError
241240
If the input is not valid for this attribute.
242241
"""
243-
244242
if (
245243
isinstance(value, list)
246244
and len(value) == 3
@@ -329,7 +327,6 @@ def convert_input(self, value):
329327
ValueError
330328
If the input is not valid for this attribute.
331329
"""
332-
333330
if value is None:
334331
return None, False
335332

@@ -396,7 +393,6 @@ def convert_input(self, value):
396393
ValueError
397394
If the input is not valid for this attribute.
398395
"""
399-
400396
if value is None:
401397
return None, False
402398
elif isinstance(value, EarthLocation):
@@ -520,7 +516,6 @@ def convert_input(self, value):
520516
ValueError
521517
If the input is not valid for this attribute.
522518
"""
523-
524519
if value is None:
525520
return None, False
526521

astropy/coordinates/baseframe.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def _get_repr_cls(value):
4242
"""
4343
Return a valid representation class from ``value`` or raise exception.
4444
"""
45-
4645
if value in r.REPRESENTATION_CLASSES:
4746
value = r.REPRESENTATION_CLASSES[value]
4847
elif not isinstance(value, type) or not issubclass(value, r.BaseRepresentation):
@@ -60,7 +59,6 @@ def _get_diff_cls(value):
6059
As originally created, this is only used in the SkyCoord initializer, so if
6160
that is refactored, this function my no longer be necessary.
6261
"""
63-
6462
if value in r.DIFFERENTIAL_CLASSES:
6563
value = r.DIFFERENTIAL_CLASSES[value]
6664
elif not isinstance(value, type) or not issubclass(value, r.BaseDifferential):
@@ -1090,7 +1088,6 @@ def represent_as(self, base, s="base", in_frame_units=False):
10901088
<SkyCoord (ICRS): (x, y, z) [dimensionless]
10911089
(1., 0., 0.)>
10921090
"""
1093-
10941091
# For backwards compatibility (because in_frame_units used to be the
10951092
# 2nd argument), we check to see if `new_differential` is a boolean. If
10961093
# it is, we ignore the value of `new_differential` and warn about the
@@ -1485,7 +1482,6 @@ def __repr__(self):
14851482

14861483
def _data_repr(self):
14871484
"""Returns a string representation of the coordinate data."""
1488-
14891485
if not self.has_data:
14901486
return ""
14911487

@@ -1729,7 +1725,6 @@ def __getattr__(self, attr):
17291725
TODO: We should handle dynamic representation transforms here (e.g.,
17301726
`.cylindrical`) instead of defining properties as below.
17311727
"""
1732-
17331728
# attr == '_representation' is likely from the hasattr() test in the
17341729
# representation property which is used for
17351730
# self.representation_component_names.
@@ -1871,7 +1866,6 @@ def separation_3d(self, other):
18711866
ValueError
18721867
If this or the other coordinate do not have distances.
18731868
"""
1874-
18751869
from .distances import Distance
18761870

18771871
if issubclass(self.data.__class__, r.UnitSphericalRepresentation):
@@ -1908,7 +1902,6 @@ def cartesian(self):
19081902
Shorthand for a cartesian representation of the coordinates in this
19091903
object.
19101904
"""
1911-
19121905
# TODO: if representations are updated to use a full transform graph,
19131906
# the representation aliases should not be hard-coded like this
19141907
return self.represent_as("cartesian", in_frame_units=True)
@@ -1919,7 +1912,6 @@ def cylindrical(self):
19191912
Shorthand for a cylindrical representation of the coordinates in this
19201913
object.
19211914
"""
1922-
19231915
# TODO: if representations are updated to use a full transform graph,
19241916
# the representation aliases should not be hard-coded like this
19251917
return self.represent_as("cylindrical", in_frame_units=True)
@@ -1930,7 +1922,6 @@ def spherical(self):
19301922
Shorthand for a spherical representation of the coordinates in this
19311923
object.
19321924
"""
1933-
19341925
# TODO: if representations are updated to use a full transform graph,
19351926
# the representation aliases should not be hard-coded like this
19361927
return self.represent_as("spherical", in_frame_units=True)
@@ -1942,7 +1933,6 @@ def sphericalcoslat(self):
19421933
`~astropy.coordinates.SphericalCosLatDifferential` for the velocity
19431934
data in this object.
19441935
"""
1945-
19461936
# TODO: if representations are updated to use a full transform graph,
19471937
# the representation aliases should not be hard-coded like this
19481938
return self.represent_as("spherical", "sphericalcoslat", in_frame_units=True)

0 commit comments

Comments
 (0)