8000 Merge pull request #5368 from tacaswell/sundry_doc_changes · numpy/numpy@3ef77ee · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ef77ee

Browse files
author
Ralf Gommers
committed
Merge pull request #5368 from tacaswell/sundry_doc_changes
Cleanups in documentation formatting.
2 parents 2070ecf + 1b908fc commit 3ef77ee

File tree

10 files changed

+51
-50
lines changed

10 files changed

+51
-50
lines changed

numpy/core/code_generators/ufunc_docstrings.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ def add_newdoc(place, name, doc):
686686
687687
Returns
688688
-------
689-
y : {ndarray, scalar}
689+
y : ndarray or scalar
690690
The ceiling of each element in `x`, with `float` dtype.
691691
692692
See Also
@@ -716,7 +716,7 @@ def add_newdoc(place, name, doc):
716716
717717
Returns
718718
-------
719-
y : {ndarray, scalar}
719+
y : ndarray or scalar
720720
The truncated value of each element in `x`.
721721
722722
See Also
@@ -931,7 +931,7 @@ def add_newdoc(place, name, doc):
931931
932932
Returns
933933
-------
934-
y : {ndarray, scalar}
934+
y : ndarray or scalar
935935
The quotient ``x1/x2``, element-wise. Returns a scalar if
936936
both ``x1`` and ``x2`` are scalars.
937937
@@ -999,7 +999,7 @@ def add_newdoc(place, name, doc):
999999
10001000
Returns
10011001
-------
1002-
out : {ndarray, bool}
1002+
out : ndarray or bool
10031003
Output array of bools, or a single bool if x1 and x2 are scalars.
10041004
10051005
See Also
@@ -1172,7 +1172,7 @@ def add_newdoc(place, name, doc):
11721172
11731173
Returns
11741174
-------
1175-
y : {ndarray, scalar}
1175+
y : ndarray or scalar
11761176
The absolute values of `x`, the returned values are always floats.
11771177
11781178
See Also
@@ -1202,7 +1202,7 @@ def add_newdoc(place, name, doc):
12021202
12031203
Returns
12041204
-------
1205-
y : {ndarray, scalar}
1205+
y : ndarray or scalar
12061206
The floor of each element in `x`.
12071207
12081208
See Also
@@ -1632,7 +1632,7 @@ def add_newdoc(place, name, doc):
16321632
16331633
Returns
16341634
-------
1635-
y : {ndarray, bool}
1635+
y : ndarray or bool
16361636
For scalar input, the result is a new boolean with value True if
16371637
the input is NaN; otherwise the value is False.
16381638
@@ -2046,7 +2046,7 @@ def add_newdoc(place, name, doc):
20462046
20472047
Returns
20482048
-------
2049-
y : {ndarray, bool}
2049+
y : ndarray or bool
20502050
Boolean result with the same shape as `x1` and `x2` of the logical
20512051
AND operation on corresponding elements of `x1` and `x2`.
20522052
@@ -2112,7 +2112,7 @@ def add_newdoc(place, name, doc):
21122112
21132113
Returns
21142114
-------
2115-
y : {ndarray, bool}
2115+
y : ndarray or bool
21162116
Boolean result with the same shape as `x1` and `x2` of the logical
21172117
OR operation on elements of `x1` and `x2`.
21182118
@@ -2193,7 +2193,7 @@ def add_newdoc(place, name, doc):
21932193
21942194
Returns
21952195
-------
2196-
y : {ndarray, scalar}
2196+
y : ndarray or scalar
21972197
The maximum of `x1` and `x2`, element-wise. Returns scalar if
21982198
both `x1` and `x2` are scalars.
21992199
@@ -2251,7 +2251,7 @@ def add_newdoc(place, name, doc):
22512251
22522252
Returns
22532253
-------
2254-
y : {ndarray, scalar}
2254+
y : ndarray or scalar
22552255
The minimum of `x1` and `x2`, element-wise. Returns scalar if
22562256
both `x1` and `x2` are scalars.
22572257
@@ -2309,7 +2309,7 @@ def add_newdoc(place, name, doc):
23092309
23102310
Returns
23112311
-------
2312-
y : {ndarray, scalar}
2312+
y : ndarray or scalar
23132313
The minimum of `x1` and `x2`, element-wise. Returns scalar if
23142314
both `x1` and `x2` are scalars.
23152315
@@ -2366,7 +2366,7 @@ def add_newdoc(place, name, doc):
23662366
23672367
Returns
23682368
-------
2369-
y : {ndarray, scalar}
2369+
y : ndarray or scalar
23702370
The minimum of `x1` and `x2`, element-wise. Returns scalar if
23712371
both `x1` and `x2` are scalars.
23722372
@@ -2780,7 +2780,7 @@ def add_newdoc(place, name, doc):
27802780
27812781
Returns
27822782
-------
2783-
out : {ndarray, scalar}
2783+
out : ndarray or scalar
27842784
Output array is same shape and type as `x`.
27852785
27862786
See Also
@@ -3365,9 +3365,9 @@ def add_newdoc(place, name, doc):
33653365
----------
33663366
x : array_like
33673367
Array of numbers to be decomposed.
3368-
out1: ndarray, optional
3368+
out1 : ndarray, optional
33693369
Output array for the mantissa. Must have the same shape as `x`.
3370-
out2: ndarray, optional
3370+
out2 : ndarray, optional
33713371
Output array for the exponent. Must have the same shape as `x`.
33723372
33733373
Returns

numpy/core/defchararray.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def equal(x1, x2):
109109
110110
Returns
111111
-------
112-
out : {ndarray, bool}
112+
out : ndarray or bool
113113
Output array of bools, or a single bool if x1 and x2 are scalars.
114114
115115
See Also
@@ -133,7 +133,7 @@ def not_equal(x1, x2):
133133
134134
Returns
135135
-------
136-
out : {ndarray, bool}
136+
out : ndarray or bool
137137
Output array of bools, or a single bool if x1 and x2 are scalars.
138138
139139
See Also
@@ -158,7 +158,7 @@ def greater_equal(x1, x2):
158158
159159
Returns
160160
-------
161-
out : {ndarray, bool}
161+
out : ndarray or bool
162162
Output array of bools, or a single bool if x1 and x2 are scalars.
163163
164164
See Also
@@ -182,7 +182,7 @@ def less_equal(x1, x2):
182182
183183
Returns
184184
-------
185-
out : {ndarray, bool}
185+
out : ndarray or bool
186186
Output array of bools, or a single bool if x1 and x2 are scalars.
187187
188188
See Also
@@ -206,7 +206,7 @@ def greater(x1, x2):
206206
207207
Returns
208208
-------
209-
out : {ndarray, bool}
209+
out : ndarray or bool
210210
Output array of bools, or a single bool if x1 and x2 are scalars.
211211
212212
See Also
@@ -230,7 +230,7 @@ def less(x1, x2):
230230
231231
Returns
232232
-------
233-
out : {ndarray, bool}
233+
out : ndarray or bool
234234
Output array of bools, or a single bool if x1 and x2 are scalars.
235235
236236
See Also

numpy/core/fromnumeric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def repeat(a, repeats, axis=None):
357357
----------
358358
a : array_like
359359
Input array.
360-
repeats : {int, array of ints}
360+
repeats : int or array of ints
361361
The number of repetitions for each element. `repeats` is broadcasted
362362
to fit the shape of the given axis.
363363
axis : int, optional

numpy/core/numeric.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,8 @@ def tensordot(a, b, axes=2):
11501150
----------
11511151
a, b : array_like, len(shape) >= 1
11521152
Tensors to "dot".
1153-
axes : {integer_like, array_like}
1153+
1154+
axes : int or (2,) array_like
11541155
* integer_like
11551156
If an int N, sum over the last N axes of `a` and the first N axes
11561157
of `b` in order. The sizes of the corresponding axes must match.
@@ -1168,11 +1169,11 @@ def tensordot(a, b, axes=2):
11681169
``axes = 0`` : tensor product $a\otimes b$
11691170
``axes = 1`` : tensor dot product $a\cdot b$
11701171
``axes = 2`` : (default) tensor double contraction $a:b$
1171-
1172-
When `axes` is integer_like, the sequence for evaluation will be: first
1173-
the -Nth axis in `a` and 0th axis in `b`, and the -1th axis in `a` and
1172+
1173+
When `axes` is integer_like, the sequence for evaluation will be: first
1174+
the -Nth axis in `a` and 0th axis in `b`, and the -1th axis in `a` and
11741175
Nth axis in `b` last.
1175-
1176+
11761177
When there is more than one axis to sum over - and they are not the last
11771178
(first) axes of `a` (`b`) - the argument `axes` should consist of
11781179
two sequences of the same length, with the first axis to sum over given

numpy/lib/arraypad.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ def pad(array, pad_width, mode=None, **kwargs):
11051105
((before, after),) yields same before and after pad for each axis.
11061106
(pad,) or int is a shortcut for before = after = pad width for all
11071107
axes.
1108-
mode : {str, function}
1108+
mode : str or function
11091109
One of the following string values or a user supplied function.
11101110
11111111
'constant'
@@ -1140,7 +1140,7 @@ def pad(array, pad_width, mode=None, **kwargs):
11401140
end values are used to pad the beginning.
11411141
<function>
11421142
Padding function, see Notes.
1143-
stat_length : {sequence, int}, optional
1143+
stat_length : sequence or int, optional
11441144
Used in 'maximum', 'mean', 'median', and 'minimum'. Number of
11451145
values at edge of each axis used to calculate the statistic value.
11461146
@@ -1154,7 +1154,7 @@ def pad(array, pad_width, mode=None, **kwargs):
11541154
length for all axes.
11551155
11561156
Default is ``None``, to use the entire axis.
1157-
constant_values : {sequence, int}, optional
1157+
constant_values : sequence or int, optional
11581158
Used in 'constant'. The values to set the padded values for each
11591159
axis.
11601160
@@ -1168,7 +1168,7 @@ def pad(array, pad_width, mode=None, **kwargs):
11681168
all axes.
11691169
11701170
Default is 0.
1171-
end_values : {sequence, int}, optional
1171+
end_values : sequence or int, optional
11721172
Used in 'linear_ramp'. The values used for the ending value of the
11731173
linear_ramp and that will form the edge of the padded array.
11741174
@@ -1182,7 +1182,7 @@ def pad(array, pad_width, mode=None, **kwargs):
11821182
all axes.
11831183
11841184
Default is 0.
1185-
reflect_type : str {'even', 'odd'}, optional
1185+
reflect_type : {'even', 'odd'}, optional
11861186
Used in 'reflect', and 'symmetric'. The 'even' style is the
11871187
default with an unaltered reflection around the edge value. For
11881188
the 'odd' style, the extented part of the array is created by

numpy/lib/financial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def pmt(rate, nper, pv, fv=0, when='end'):
148148
Number of compounding periods
149149
pv : array_like
150150
Present value
151-
fv : array_like (optional)
151+
fv : array_like, optional
152152
Future value (default = 0)
153153
when : {{'begin', 1}, {'end', 0}}, {string, int}
154154
When payments are due ('begin' (1) or 'end' (0))

numpy/lib/function_base.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def histogramdd(sample, bins=10, range=None, normed=False, weights=None):
263263
normed : bool, optional
264264
If False, returns the number of samples in each bin. If True,
265265
returns the bin density ``bin_count / sample_count / bin_volume``.
266-
weights : array_like (N,), optional
266+
weights : (N,) array_like, optional
267267
An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`.
268268
Weights are normalized to 1 if normed is True. If normed is False,
269269
the values of the returned histogram are equal to the sum of the
@@ -461,7 +461,7 @@ def average(a, axis=None, weights=None, returned=False):
461461
462462
Returns
463463
-------
464-
average, [sum_of_weights] : {array_type, double}
464+
average, [sum_of_weights] : array_type or double
465465
Return the average along the specified axis. When returned is `True`,
466466
return a tuple with the average as the first element and the sum
467467
of the weights as the second element. The return type is `Float`
@@ -885,9 +885,9 @@ def copy(a, order='K'):
885885
def gradient(f, *varargs, **kwargs):
886886
"""
887887
Return the gradient of an N-dimensional array.
888-
888+
889889
The gradient is computed using second order accurate central differences
890-
in the interior and either first differences or second order accurate
890+
in the interior and either first differences or second order accurate
891891
one-sides (forward or backwards) differences at the boundaries. The
892892
returned gradient hence has the same shape as the input array.
893893
@@ -901,7 +901,7 @@ def gradient(f, *varargs, **kwargs):
901901
edge_order : {1, 2}, optional
902902
Gradient is calculated using N\ :sup:`th` order accurate differences
903903
at the boundaries. Default: 1.
904-
904+
905905
.. versionadded:: 1.9.1
906906
907907
Returns
@@ -1147,7 +1147,7 @@ def interp(x, xp, fp, left=None, right=None, period=None):
11471147
11481148
Returns
11491149
-------
1150-
y : {float, ndarray}
1150+
y : float or ndarray
11511151
The interpolated values, same shape as `x`.
11521152
11531153
Raises
@@ -1250,7 +1250,7 @@ def angle(z, deg=0):
12501250
12511251
Returns
12521252
-------
1253-
angle : {ndarray, scalar}
1253+
angle : ndarray or scalar
12541254
The counterclockwise angle from the positive real axis on
12551255
the complex plane, with dtype as numpy.float64.
12561256
@@ -1980,7 +1980,7 @@ def corrcoef(x, y=None, rowvar=1, bias=0, ddof=None):
19801980
observations (unbiased estimate). If `bias` is 1, then
19811981
normalization is by ``N``. These values can be overridden by using
19821982
the keyword ``ddof`` in numpy versions >= 1.5.
1983-
ddof : {None, int}, optional
1983+
ddof : int, optional
19841984
.. versionadded:: 1.5
19851985
If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is
19861986
the number of observations; this overrides the value implied by

numpy/lib/polynomial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,12 @@ def polyint(p, m=1, k=None):
253253
254254
Parameters
255255
----------
256-
p : {array_like, poly1d}
256+
p : array_like or poly1d
257257
Polynomial to differentiate.
258258
A sequence is interpreted as polynomial coefficients, see `poly1d`.
259259
m : int, optional
260260
Order of the antiderivative. (Default: 1)
261-
k : {None, list of `m` scalars, scalar}, optional
261+
k : list of `m` scalars or scalar, optional
262262
Integration constants. They are given in the order of integration:
263263
those corresponding to highest-order terms come first.
264264

numpy/ma/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4978,7 +4978,7 @@ def argmin(self, axis=None, fill_value=None, out=None):
49784978
49794979
Returns
49804980
-------
4981-
{ndarray, scalar}
4981+
ndarray or scalar
49824982
If multi-dimension input, returns a new ndarray of indices to the
49834983
minimum values along the given axis. Otherwise, returns a scalar
49844984
of index to the minimum values along the given axis.

0 commit comments

Comments
 (0)
0