Skip to content

Commit afd231b

Browse files
authored
DOC: Autoreformat all docstrings. (#5122)
Surprisingly not many changes, most of them are adding leading */** to args, kwargs which is not clear according to numpydoc but seem like the thigs to do, plus it's already done in a few other places. A couple of spaces before `:`, that semantically matter. Numpydoc improperly parse the types if there is no space before the :, a documented parameter that does not exist on the function, and some casing of section names. There are a couple errors that this was not able to autofix (like missing blank line before `Returns` section leading Numpydoc to inpterprete "Returns" as a parameter of the function in xarray/core/dataset.py:roll extra parameters: {'-------', 'rolled', 'Returns'}
1 parent 903278a commit afd231b

File tree

7 files changed

+20
-23
lines changed

7 files changed

+20
-23
lines changed

xarray/core/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,9 @@ def assign_attrs(self, *args, **kwargs):
490490
491491
Parameters
492492
----------
493-
args
493+
*args
494494
positional arguments passed into ``attrs.update``.
495-
kwargs
495+
**kwargs
496496
keyword arguments passed into ``attrs.update``.
497497
498498
Returns
@@ -527,9 +527,9 @@ def pipe(
527527
Alternatively a ``(callable, data_keyword)`` tuple where
528528
``data_keyword`` is a string indicating the keyword of
529529
``callable`` that expects the xarray object.
530-
args
530+
*args
531531
positional arguments passed into ``func``.
532-
kwargs
532+
**kwargs
533533
a dictionary of keyword arguments passed into ``func``.
534534
535535
Returns

xarray/core/computation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ def dot(*arrays, dims=None, **kwargs):
13551355
13561356
Parameters
13571357
----------
1358-
arrays : DataArray or Variable
1358+
*arrays : DataArray or Variable
13591359
Arrays to compute.
13601360
dims : ..., str or tuple of str, optional
13611361
Which dimensions to sum over. Ellipsis ('...') sums over all dimensions.

xarray/core/dask_array_compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ def ensure_minimum_chunksize(size, chunks):
105105
106106
Parameters
107107
----------
108-
size: int
108+
size : int
109109
The maximum size of any chunk.
110-
chunks: tuple
110+
chunks : tuple
111111
Chunks along one axis, e.g. ``(3, 3, 2)``
112112
113113
Examples

xarray/core/dataarray.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,9 +2131,6 @@ def to_unstacked_dataset(self, dim, level=0):
21312131
level : int or str
21322132
The MultiIndex level to expand to a dataset along. Can either be
21332133
the integer index of the level or its name.
2134-
label : int, default: 0
2135-
Label of the level to expand dataset along. Overrides the label
2136-
argument if given.
21372134
21382135
Returns
21392136
-------
@@ -2455,7 +2452,7 @@ def interpolate_na(
24552452
If True, the dataarray's attributes (`attrs`) will be copied from
24562453
the original object to the new one. If False, the new
24572454
object will be returned without attributes.
2458-
kwargs : dict, optional
2455+
**kwargs : dict, optional
24592456
parameters passed verbatim to the underlying interpolation function
24602457
24612458
Returns
@@ -4379,7 +4376,7 @@ def query(
43794376
The default of 'pandas' parses code slightly different than standard
43804377
Python. Alternatively, you can parse an expression using the 'python'
43814378
parser to retain strict Python semantics.
4382-
engine: {"python", "numexpr", None}, default: None
4379+
engine : {"python", "numexpr", None}, default: None
43834380
The engine used to evaluate the expression. Supported engines are:
43844381
- None: tries to use numexpr, falls back to python
43854382
- "numexpr": evaluates expressions using numexpr
@@ -4462,7 +4459,7 @@ def curvefit(
44624459
Optional dictionary of parameter names to bounding values passed to the
44634460
`curve_fit` `bounds` arg. If none or only some parameters are passed, the rest
44644461
will be unbounded following the default scipy behavior.
4465-
param_names: seq, optional
4462+
param_names : seq, optional
44664463
Sequence of names for the fittable parameters of `func`. If not supplied,
44674464
this will be automatically determined by arguments of `func`. `param_names`
44684465
should be manually supplied when fitting a function that takes a variable
@@ -4480,7 +4477,7 @@ def curvefit(
44804477
[var]_curvefit_covariance
44814478
The covariance matrix of the coefficient estimates.
44824479
4483-
See also
4480+
See Also
44844481
--------
44854482
DataArray.polyfit
44864483
scipy.optimize.curve_fit

xarray/core/dataset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4568,7 +4568,7 @@ def interpolate_na(
45684568
* x (x) int64 0 1 2 3 4 5 6 7 8
45694569
45704570
The gap lengths are 3-0 = 3; 6-3 = 3; and 8-6 = 2 respectively
4571-
kwargs : dict, optional
4571+
**kwargs : dict, optional
45724572
parameters passed verbatim to the underlying interpolation function
45734573
45744574
Returns
@@ -7087,7 +7087,7 @@ def query(
70877087
The default of 'pandas' parses code slightly different than standard
70887088
Python. Alternatively, you can parse an expression using the 'python'
70897089
parser to retain strict Python semantics.
7090-
engine: {"python", "numexpr", None}, default: None
7090+
engine : {"python", "numexpr", None}, default: None
70917091
The engine used to evaluate the expression. Supported engines are:
70927092
- None: tries to use numexpr, falls back to python
70937093
- "numexpr": evaluates expressions using numexpr
@@ -7178,7 +7178,7 @@ def curvefit(
71787178
Optional dictionary of parameter names to bounding values passed to the
71797179
`curve_fit` `bounds` arg. If none or only some parameters are passed, the rest
71807180
will be unbounded following the default scipy behavior.
7181-
param_names: seq, optional
7181+
param_names : seq, optional
71827182
Sequence of names for the fittable parameters of `func`. If not supplied,
71837183
this will be automatically determined by arguments of `func`. `param_names`
71847184
should be manually supplied when fitting a function that takes a variable
@@ -7196,7 +7196,7 @@ def curvefit(
71967196
[var]_curvefit_covariance
71977197
The covariance matrix of the coefficient estimates.
71987198
7199-
See also
7199+
See Also
72007200
--------
72017201
Dataset.polyfit
72027202
scipy.optimize.curve_fit

xarray/plot/facetgrid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def map_dataarray(self, func, x, y, **kwargs):
238238
plotting method such as `xarray.plot.imshow`
239239
x, y : string
240240
Names of the coordinates to plot on x, y axes
241-
kwargs
241+
**kwargs
242242
additional keyword arguments to func
243243
244244
Returns
@@ -507,7 +507,7 @@ def set_titles(self, template="{coord} = {value}", maxchar=30, size=None, **kwar
507507
Template for plot titles containing {coord} and {value}
508508
maxchar : int
509509
Truncate titles at maxchar
510-
kwargs : keyword args
510+
**kwargs : keyword args
511511
additional arguments to matplotlib.text
512512
513513
Returns
@@ -603,11 +603,11 @@ def map(self, func, *args, **kwargs):
603603
must plot to the currently active matplotlib Axes and take a
604604
`color` keyword argument. If faceting on the `hue` dimension,
605605
it must also take a `label` keyword argument.
606-
args : strings
606+
*args : strings
607607
Column names in self.data that identify variables with data to
608608
plot. The data for each variable is passed to `func` in the
609609
order the variables are specified in the call.
610-
kwargs : keyword arguments
610+
**kwargs : keyword arguments
611611
All keyword arguments are passed to the plotting function.
612612
613613
Returns

xarray/tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def open_dataset(
6262
The directory in which to search for and write cached data.
6363
cache : bool, optional
6464
If True, then cache data locally for use on subsequent calls
65-
kws : dict, optional
65+
**kws : dict, optional
6666
Passed to xarray.open_dataset
6767
6868
Notes

0 commit comments

Comments
 (0)