Skip to content

Commit

Permalink
Merge pull request #14285 from nstarman/ruff-more-pydocstyle
Browse files Browse the repository at this point in the history
Ruff: more pydocstyle
  • Loading branch information
nstarman committed Feb 1, 2023
2 parents 11afbc2 + ed47e90 commit 4e88b6d
Show file tree
Hide file tree
Showing 57 changed files with 66 additions and 158 deletions.
2 changes: 0 additions & 2 deletions astropy/config/paths.py
Expand Up @@ -221,7 +221,6 @@ class set_temp_config(_SetTempPath):
Parameters
----------
path : str, optional
The directory (which must exist) in which to find the Astropy config
files, or create them if they do not already exist. If None, this
Expand Down Expand Up @@ -272,7 +271,6 @@ class set_temp_cache(_SetTempPath):
Parameters
----------
path : str
The directory (which must exist) in which to find the Astropy cache
files, or create them if they do not already exist. If None, this
Expand Down
6 changes: 3 additions & 3 deletions astropy/convolution/kernels.py
Expand Up @@ -881,7 +881,7 @@ class Model1DKernel(Kernel1D):
TypeError
If model is not an instance of `~astropy.modeling.Fittable1DModel`
See also
See Also
--------
Model2DKernel : Create kernel from `~astropy.modeling.Fittable2DModel`
CustomKernel : Create kernel from list or array
Expand Down Expand Up @@ -949,7 +949,7 @@ class Model2DKernel(Kernel2D):
TypeError
If model is not an instance of `~astropy.modeling.Fittable2DModel`
See also
See Also
--------
Model1DKernel : Create kernel from `~astropy.modeling.Fittable1DModel`
CustomKernel : Create kernel from list or array
Expand Down Expand Up @@ -997,7 +997,7 @@ class CustomKernel(Kernel):
`~astropy.convolution.KernelSizeError`
If array size is even.
See also
See Also
--------
Model2DKernel, Model1DKernel
Expand Down
3 changes: 0 additions & 3 deletions astropy/coordinates/errors.py
Expand Up @@ -41,7 +41,6 @@ class IllegalHourError(RangeError):
Examples
--------
.. code-block:: python
if not 0 <= hr < 24:
Expand Down Expand Up @@ -90,7 +89,6 @@ class IllegalMinuteError(RangeError):
Examples
--------
.. code-block:: python
if not 0 <= min < 60:
Expand Down Expand Up @@ -140,7 +138,6 @@ class IllegalSecondError(RangeError):
Examples
--------
.. code-block:: python
if not 0 <= sec < 60:
Expand Down
1 change: 0 additions & 1 deletion astropy/coordinates/transformations.py
Expand Up @@ -405,7 +405,6 @@ def get_transform(self, fromsys, tosys):
Notes
-----
A `~astropy.coordinates.CompositeTransform` is always returned, because
`~astropy.coordinates.CompositeTransform` is slightly more adaptable in
the way it can be called than other transform classes. Specifically, it
Expand Down
1 change: 0 additions & 1 deletion astropy/io/ascii/core.py
Expand Up @@ -72,7 +72,6 @@ class CsvWriter:
Examples
--------
>>> from astropy.io.ascii.core import CsvWriter
>>> writer = CsvWriter(delimiter=' ')
>>> print(writer.writerow(['hello', '', 'world']))
Expand Down
1 change: 0 additions & 1 deletion astropy/io/ascii/ecsv.py
Expand Up @@ -459,7 +459,6 @@ class Ecsv(basic.Basic):
Examples
--------
>>> from astropy.table import Table
>>> ecsv_content = '''# %ECSV 0.9
... # ---
Expand Down
1 change: 0 additions & 1 deletion astropy/io/fits/_tiled_compression/tiled_compression.py
Expand Up @@ -255,7 +255,6 @@ def decompress_hdu(hdu):
Returns
-------
data : `numpy.ndarray`
The decompressed data array.
"""
Expand Down
1 change: 0 additions & 1 deletion astropy/io/fits/column.py
Expand Up @@ -1469,7 +1469,6 @@ def __init__(self, input, ascii=False):
"""
Parameters
----------
input : sequence of `Column` or `ColDefs` or ndarray or `~numpy.recarray`
An existing table HDU, an existing `ColDefs`, or any multi-field
Numpy array or `numpy.recarray`.
Expand Down
1 change: 0 additions & 1 deletion astropy/io/fits/convenience.py
Expand Up @@ -381,7 +381,6 @@ def delval(filename, keyword, *args, **kwargs):
Parameters
----------
filename : path-like or file-like
Name of the FITS file, or file object If opened, mode must be update
(rb+). An opened file object or `~gzip.GzipFile` object will be closed
Expand Down
1 change: 0 additions & 1 deletion astropy/io/fits/hdu/compressed.py
Expand Up @@ -1793,7 +1793,6 @@ def scale(self, type=None, option="old", bscale=1, bzero=0):
Parameters
----------
type : str, optional
destination data type, use a string representing a numpy dtype
name, (e.g. ``'uint8'``, ``'int16'``, ``'float32'`` etc.). If is
Expand Down
1 change: 0 additions & 1 deletion astropy/io/fits/header.py
Expand Up @@ -371,7 +371,6 @@ def fromstring(cls, data, sep=""):
Examples
--------
>>> from astropy.io.fits import Header
>>> hdr = Header({'SIMPLE': True})
>>> Header.fromstring(hdr.tostring()) == hdr
Expand Down
5 changes: 2 additions & 3 deletions astropy/io/fits/util.py
Expand Up @@ -54,7 +54,6 @@ class NotifierMixin:
Examples
--------
>>> class Widget(NotifierMixin):
... state = 1
... def __init__(self, name):
Expand Down Expand Up @@ -147,8 +146,8 @@ def first(iterable):
"""
Returns the first item returned by iterating over an iterable object.
Example:
Examples
--------
>>> a = [1, 2, 3]
>>> first(a)
1
Expand Down
2 changes: 1 addition & 1 deletion astropy/io/misc/parquet.py
Expand Up @@ -84,7 +84,7 @@ def read_table_parquet(
``value`` must be a collection such as a ``list``, a ``set`` or a
``tuple``.
Examples:
For example:
.. code-block:: python
Expand Down
61 changes: 30 additions & 31 deletions astropy/io/misc/yaml.py
Expand Up @@ -18,41 +18,40 @@
- `astropy.coordinates.EarthLocation`
- `astropy.table.SerializedColumn`
Example
=======
::
>>> from astropy.io.misc import yaml
>>> import astropy.units as u
>>> from astropy.time import Time
>>> from astropy.coordinates import EarthLocation
>>> t = Time(2457389.0, format='mjd',
... location=EarthLocation(1000, 2000, 3000, unit=u.km))
>>> td = yaml.dump(t)
>>> print(td)
!astropy.time.Time
format: mjd
in_subfmt: '*'
jd1: 4857390.0
jd2: -0.5
location: !astropy.coordinates.earth.EarthLocation
Examples
--------
>>> from astropy.io.misc import yaml
>>> import astropy.units as u
>>> from astropy.time import Time
>>> from astropy.coordinates import EarthLocation
>>> t = Time(2457389.0, format='mjd',
... location=EarthLocation(1000, 2000, 3000, unit=u.km))
>>> td = yaml.dump(t)
>>> print(td)
!astropy.time.Time
format: mjd
in_subfmt: '*'
jd1: 4857390.0
jd2: -0.5
location: !astropy.coordinates.earth.EarthLocation
ellipsoid: WGS84
x: !astropy.units.Quantity
unit: &id001 !astropy.units.Unit {unit: km}
value: 1000.0
unit: &id001 !astropy.units.Unit {unit: km}
value: 1000.0
y: !astropy.units.Quantity
unit: *id001
value: 2000.0
unit: *id001
value: 2000.0
z: !astropy.units.Quantity
unit: *id001
value: 3000.0
out_subfmt: '*'
precision: 3
scale: utc
>>> ty = yaml.load(td)
>>> ty
<Time object: scale='utc' format='mjd' value=2457389.0>
>>> ty.location # doctest: +FLOAT_CMP
<EarthLocation (1000., 2000., 3000.) km>
unit: *id001
value: 3000.0
out_subfmt: '*'
precision: 3
scale: utc
>>> ty = yaml.load(td)
>>> ty
<Time object: scale='utc' format='mjd' value=2457389.0>
>>> ty.location # doctest: +FLOAT_CMP
<EarthLocation (1000., 2000., 3000.) km>
"""

import base64
Expand Down
1 change: 0 additions & 1 deletion astropy/io/votable/exceptions.py
Expand Up @@ -5,7 +5,6 @@
Warnings
--------
.. note::
Most of the following warnings indicate violations of the VOTable
specification. They should be reported to the authors of the
Expand Down
4 changes: 0 additions & 4 deletions astropy/logger.py
Expand Up @@ -422,15 +422,13 @@ def log_to_file(self, filename, filter_level=None, filter_origin=None):
Notes
-----
By default, the logger already outputs log messages to a file set in
the Astropy configuration file. Using this context manager does not
stop log messages from being output to that file, nor does it stop log
messages from being printed to standard output.
Examples
--------
The context manager is used as::
with logger.log_to_file('myfile.log'):
Expand Down Expand Up @@ -471,13 +469,11 @@ def log_to_list(self, filter_level=None, filter_origin=None):
Notes
-----
Using this context manager does not stop log messages from being
output to standard output.
Examples
--------
The context manager is used as::
with logger.log_to_list() as log_list:
Expand Down
9 changes: 2 additions & 7 deletions astropy/modeling/core.py
Expand Up @@ -1428,7 +1428,6 @@ def bounding_box(self):
Examples
--------
Setting the ``bounding_box`` limits for a 1D and 2D model:
>>> from astropy.modeling.models import Gaussian1D, Gaussian2D
Expand Down Expand Up @@ -1605,7 +1604,6 @@ def without_units_for_data(self, **kwargs):
Notes
-----
This method is needed in order to be able to fit models with units in
the parameters, since we need to temporarily strip away the units from
the model during the fitting (which might be done by e.g. scipy
Expand Down Expand Up @@ -1656,7 +1654,6 @@ def output_units(self, **kwargs):
Notes
-----
This method is needed in order to be able to fit models with units in
the parameters, since we need to temporarily strip away the units from
the model during the fitting (which might be done by e.g. scipy
Expand Down Expand Up @@ -1698,7 +1695,6 @@ def with_units_from_data(self, **kwargs):
Notes
-----
This method is needed in order to be able to fit models with units in
the parameters, since we need to temporarily strip away the units from
the model during the fitting (which might be done by e.g. scipy
Expand Down Expand Up @@ -2330,7 +2326,6 @@ def coerce_units(
Examples
--------
Wrapping a unitless model to require and convert units:
>>> from astropy.modeling.models import Polynomial1D
Expand Down Expand Up @@ -4253,7 +4248,6 @@ def fix_inputs(modelinstance, values, bounding_boxes=None, selector_args=None):
Examples
--------
>>> from astropy.modeling.models import Gaussian2D
>>> g = Gaussian2D(1, 2, 3, 4, 5)
>>> gv = fix_inputs(g, {0: 2.5})
Expand Down Expand Up @@ -4646,7 +4640,8 @@ def hide_inverse(model):
model's inverse. This is to handle cases where user provided inverse
functions are not compatible within an expression.
Example:
For example::
compound_model.inverse = hide_inverse(m1) + m2 + m3
This will insure that the defined inverse itself won't attempt to
Expand Down
2 changes: 2 additions & 0 deletions astropy/modeling/fitting.py
Expand Up @@ -388,6 +388,7 @@ class LinearLSQFitter(metaclass=_FitterMeta):
Uses `numpy.linalg.lstsq` to do the fitting.
Given a model and data, fits the model to the data and changes the
model's parameters. Keeps a dictionary of auxiliary fitting information.
Notes
-----
Note that currently LinearLSQFitter does not support compound models.
Expand Down Expand Up @@ -925,6 +926,7 @@ def __call__(self, model, x, y, z=None, weights=None, **kwargs):
Weights to be passed to the fitter.
kwargs : dict, optional
Keyword arguments to be passed to the fitter.
Returns
-------
fitted_model : `~astropy.modeling.FittableModel`
Expand Down
2 changes: 0 additions & 2 deletions astropy/modeling/functional_models.py
Expand Up @@ -617,7 +617,6 @@ class Scale(Fittable1DModel):
Notes
-----
If ``factor`` is a `~astropy.units.Quantity` then the units will be
stripped before the scaling operation.
Expand Down Expand Up @@ -3282,7 +3281,6 @@ class KingProjectedAnalytic1D(Fittable1DModel):
Notes
-----
This model approximates a King model with an analytic function. The derivation of this
equation can be found in King '62 (equation 14). This is just an approximation of the
full model and the parameters derived from this model should be taken with caution.
Expand Down
3 changes: 0 additions & 3 deletions astropy/modeling/mappings.py
Expand Up @@ -38,7 +38,6 @@ class Mapping(FittableModel):
Examples
--------
>>> from astropy.modeling.models import Polynomial2D, Shift, Mapping
>>> poly1 = Polynomial2D(1, c0_0=1, c1_0=2, c0_1=3)
>>> poly2 = Polynomial2D(1, c0_0=1, c1_0=2.4, c0_1=2.1)
Expand Down Expand Up @@ -145,7 +144,6 @@ class Identity(Mapping):
Examples
--------
Transform ``(x, y)`` by a shift in x, followed by scaling the two inputs::
>>> from astropy.modeling.models import (Polynomial1D, Shift, Scale,
Expand Down Expand Up @@ -213,7 +211,6 @@ class UnitsMapping(Model):
Examples
--------
Wrapping a unitless model to require and convert units:
>>> from astropy.modeling.models import Polynomial1D, UnitsMapping
Expand Down

0 comments on commit 4e88b6d

Please sign in to comment.