Skip to content

Commit 96a8ca8

Browse files
Apply ruff/pycodestyle rule W291
W291 Trailing whitespace
1 parent 37b3c3c commit 96a8ca8

Some content is hidden

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

45 files changed

+141
-141
lines changed

doc/source/user/plots/matplotlib1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
a = np.array([2, 1, 5, 7, 4, 6, 8, 14, 10, 9, 18, 20, 22])
55

6-
plt.plot(a)
6+
plt.plot(a)
77
plt.show()

numpy/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
vstack, where, zeros, zeros_like
170170
)
171171

172-
# NOTE: It's still under discussion whether these aliases
172+
# NOTE: It's still under discussion whether these aliases
173173
# should be removed.
174174
for ta in ["float96", "float128", "complex192", "complex256"]:
175175
try:
@@ -184,21 +184,21 @@
184184
histogram, histogram_bin_edges, histogramdd
185185
)
186186
from .lib._nanfunctions_impl import (
187-
nanargmax, nanargmin, nancumprod, nancumsum, nanmax, nanmean,
187+
nanargmax, nanargmin, nancumprod, nancumsum, nanmax, nanmean,
188188
nanmedian, nanmin, nanpercentile, nanprod, nanquantile, nanstd,
189189
nansum, nanvar
190190
)
191191
from .lib._function_base_impl import (
192-
select, piecewise, trim_zeros, copy, iterable, percentile, diff,
192+
select, piecewise, trim_zeros, copy, iterable, percentile, diff,
193193
gradient, angle, unwrap, sort_complex, flip, rot90, extract, place,
194194
vectorize, asarray_chkfinite, average, bincount, digitize, cov,
195195
corrcoef, median, sinc, hamming, hanning, bartlett, blackman,
196196
kaiser, trapezoid, trapz, i0, meshgrid, delete, insert, append,
197197
interp, quantile
198198
)
199199
from .lib._twodim_base_impl import (
200-
diag, diagflat, eye, fliplr, flipud, tri, triu, tril, vander,
201-
histogram2d, mask_indices, tril_indices, tril_indices_from,
200+
diag, diagflat, eye, fliplr, flipud, tri, triu, tril, vander,
201+
histogram2d, mask_indices, tril_indices, tril_indices_from,
202202
triu_indices, triu_indices_from
203203
)
204204
from .lib._shape_base_impl import (
@@ -207,7 +207,7 @@
207207
take_along_axis, tile, vsplit
208208
)
209209
from .lib._type_check_impl import (
210-
iscomplexobj, isrealobj, imag, iscomplex, isreal, nan_to_num, real,
210+
iscomplexobj, isrealobj, imag, iscomplex, isreal, nan_to_num, real,
211211
real_if_close, typename, mintypecode, common_type
212212
)
213213
from .lib._arraysetops_impl import (
@@ -232,7 +232,7 @@
232232
)
233233
from .lib._index_tricks_impl import (
234234
diag_indices_from, diag_indices, fill_diagonal, ndindex, ndenumerate,
235-
ix_, c_, r_, s_, ogrid, mgrid, unravel_index, ravel_multi_index,
235+
ix_, c_, r_, s_, ogrid, mgrid, unravel_index, ravel_multi_index,
236236
index_exp
237237
)
238238

@@ -246,7 +246,7 @@
246246
# (experimental label) are not added here, because `from numpy import *`
247247
# must not raise any warnings - that's too disruptive.
248248
__numpy_submodules__ = {
249-
"linalg", "fft", "dtypes", "random", "polynomial", "ma",
249+
"linalg", "fft", "dtypes", "random", "polynomial", "ma",
250250
"exceptions", "lib", "ctypeslib", "testing", "typing",
251251
"f2py", "test", "rec", "char", "core", "strings",
252252
}
@@ -419,7 +419,7 @@ def __dir__():
419419
globals().keys() | __numpy_submodules__
420420
)
421421
public_symbols -= {
422-
"matrixlib", "matlib", "tests", "conftest", "version",
422+
"matrixlib", "matlib", "tests", "conftest", "version",
423423
"compat", "distutils", "array_api"
424424
}
425425
return list(public_symbols)
@@ -495,7 +495,7 @@ def _mac_os_check():
495495
def hugepage_setup():
496496
"""
497497
We usually use madvise hugepages support, but on some old kernels it
498-
is slow and thus better avoided. Specifically kernel version 4.6
498+
is slow and thus better avoided. Specifically kernel version 4.6
499499
had a bug fix which probably fixed this:
500500
https://github.com/torvalds/linux/commit/7cf91a98e607c2f935dbcc177d70011e95b8faff
501501
"""
@@ -504,7 +504,7 @@ def hugepage_setup():
504504
# If there is an issue with parsing the kernel version,
505505
# set use_hugepage to 0. Usage of LooseVersion will handle
506506
# the kernel version parsing better, but avoided since it
507-
# will increase the import time.
507+
# will increase the import time.
508508
# See: #16679 for related discussion.
509509
try:
510510
use_hugepage = 1

numpy/_core/_add_newdocs_scalars.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ def add_newdoc_for_scalar_type(obj, fixed_aliases, doc):
294294
or datetime format.
295295
296296
When parsing a string to create a datetime object, if the string contains
297-
a trailing timezone (A 'Z' or a timezone offset), the timezone will be
297+
a trailing timezone (A 'Z' or a timezone offset), the timezone will be
298298
dropped and a User Warning is given.
299299
300-
Datetime64 objects should be considered to be UTC and therefore have an
300+
Datetime64 objects should be considered to be UTC and therefore have an
301301
offset of +0000.
302302
303303
>>> np.datetime64(10, 'Y')

numpy/_core/_type_aliases.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
# extra aliases are added only to `sctypeDict`
6565
# to support dtype name access, such as`np.dtype("float")`
66-
_extra_aliases = {
66+
_extra_aliases = {
6767
"float": "float64",
6868
"complex": "complex128",
6969
"object": "object_",
@@ -104,8 +104,8 @@
104104

105105
# find proper group for each concrete type
106106
for type_group, abstract_type in [
107-
("int", ma.signedinteger), ("uint", ma.unsignedinteger),
108-
("float", ma.floating), ("complex", ma.complexfloating),
107+
("int", ma.signedinteger), ("uint", ma.unsignedinteger),
108+
("float", ma.floating), ("complex", ma.complexfloating),
109109
("others", ma.generic)
110110
]:
111111
if issubclass(concrete_type, abstract_type):

numpy/_core/code_generators/ufunc_docstrings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3707,7 +3707,7 @@ def add_newdoc(place, name, doc):
37073707
There is more than one definition of sign in common use for complex
37083708
numbers. The definition used here, :math:`x/|x|`, is the more common
37093709
and useful one, but is different from the one used in numpy prior to
3710-
version 2.0, :math:`x/\\sqrt{x*x}`, which is equivalent to
3710+
version 2.0, :math:`x/\\sqrt{x*x}`, which is equivalent to
37113711
``sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j``.
37123712
37133713
Examples
@@ -4650,7 +4650,7 @@ def add_newdoc(place, name, doc):
46504650
array(True)
46514651
>>> a = np.array(["hello", "HELLO", "Hello"])
46524652
>>> np.strings.isupper(a)
4653-
array([False, True, False])
4653+
array([False, True, False])
46544654
46554655
""")
46564656

numpy/_core/defchararray.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from typing import (
33
overload,
44
TypeVar,
55
Any,
6-
SupportsIndex,
6+
SupportsIndex,
77
SupportsInt,
88
)
99

@@ -16,8 +16,8 @@ from numpy import (
1616
int_,
1717
object_,
1818
_OrderKACF,
19-
_ShapeType_co,
20-
_CharDType,
19+
_ShapeType_co,
20+
_CharDType,
2121
_SupportsBuffer,
2222
)
2323

numpy/_core/einsumfunc.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _optimal_path(input_sets, output_set, idx_dict, memory_limit):
219219
return path
220220

221221
def _parse_possible_contraction(
222-
positions, input_sets, output_set, idx_dict,
222+
positions, input_sets, output_set, idx_dict,
223223
memory_limit, path_cost, naive_cost
224224
):
225225
"""Compute the cost (removed size + flops) and resultant indices for
@@ -290,7 +290,7 @@ def _update_other_results(results, best):
290290
Parameters
291291
----------
292292
results : list
293-
List of contraction results produced by
293+
List of contraction results produced by
294294
``_parse_possible_contraction``.
295295
best : list
296296
The best contraction of ``results`` i.e. the one that
@@ -833,7 +833,7 @@ def einsum_path(*operands, optimize='greedy', einsum_call=False):
833833
834834
>>> print(path_info[0])
835835
['einsum_path', (0, 2), (0, 3), (0, 2), (0, 1)]
836-
>>> print(path_info[1])
836+
>>> print(path_info[1])
837837
Complete contraction: ea,fb,abcd,gc,hd->efgh # may vary
838838
Naive scaling: 8
839839
Optimized scaling: 5
@@ -1183,15 +1183,15 @@ def einsum(*operands, out=None, optimize=False, **kwargs):
11831183
``np.einsum('i->', a)`` is like :py:func:`np.sum(a) <numpy.sum>`
11841184
if ``a`` is a 1-D array, and ``np.einsum('ii->i', a)``
11851185
is like :py:func:`np.diag(a) <numpy.diag>` if ``a`` is a square 2-D array.
1186-
The difference is that `einsum` does not allow broadcasting by default.
1186+
The difference is that `einsum` does not allow broadcasting by default.
11871187
Additionally ``np.einsum('ij,jh->ih', a, b)`` directly specifies the
11881188
order of the output subscript labels and therefore returns matrix
11891189
multiplication, unlike the example above in implicit mode.
11901190
11911191
To enable and control broadcasting, use an ellipsis. Default
11921192
NumPy-style broadcasting is done by adding an ellipsis
11931193
to the left of each term, like ``np.einsum('...ii->...i', a)``.
1194-
``np.einsum('...i->...', a)`` is like
1194+
``np.einsum('...i->...', a)`` is like
11951195
:py:func:`np.sum(a, axis=-1) <numpy.sum>` for array ``a`` of any shape.
11961196
To take the trace along the first and last axes,
11971197
you can do ``np.einsum('i...i', a)``, or to do a matrix-matrix
@@ -1413,7 +1413,7 @@ def einsum(*operands, out=None, optimize=False, **kwargs):
14131413
14141414
Optimal `einsum` (best usage pattern in some use cases): ~110ms
14151415
1416-
>>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a,
1416+
>>> path = np.einsum_path('ijk,ilm,njm,nlk,abc->',a,a,a,a,a,
14171417
... optimize='optimal')[0]
14181418
>>> for iteration in range(500):
14191419
... _ = np.einsum('ijk,ilm,njm,nlk,abc->',a,a,a,a,a, optimize=path)

numpy/_core/fromnumeric.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,10 +653,10 @@ def transpose(a, axes=None):
653653
Input array.
654654
axes : tuple or list of ints, optional
655655
If specified, it must be a tuple or list which contains a permutation
656-
of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative
657-
indices can also be used to specify axes. The i-th axis of the returned
658-
array will correspond to the axis numbered ``axes[i]`` of the input.
659-
If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses
656+
of [0, 1, ..., N-1] where N is the number of axes of `a`. Negative
657+
indices can also be used to specify axes. The i-th axis of the returned
658+
array will correspond to the axis numbered ``axes[i]`` of the input.
659+
If not specified, defaults to ``range(a.ndim)[::-1]``, which reverses
660660
the order of the axes.
661661
662662
Returns

numpy/_core/multiarray.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
Create the numpy._core.multiarray namespace for backward compatibility.
3-
In v1.16 the multiarray and umath c-extension modules were merged into
4-
a single _multiarray_umath extension module. So we replicate the old
2+
Create the numpy._core.multiarray namespace for backward compatibility.
3+
In v1.16 the multiarray and umath c-extension modules were merged into
4+
a single _multiarray_umath extension module. So we replicate the old
55
namespace by importing from the extension module.
66
77
"""
@@ -43,7 +43,7 @@
4343
'unpackbits', 'unravel_index', 'vdot', 'where', 'zeros',
4444
'_get_promotion_state', '_set_promotion_state']
4545

46-
# For backward compatibility, make sure pickle imports
46+
# For backward compatibility, make sure pickle imports
4747
# these functions from here
4848
_reconstruct.__module__ = 'numpy._core.multiarray'
4949
scalar.__module__ = 'numpy._core.multiarray'
@@ -162,10 +162,10 @@ def empty_like(
162162
def concatenate(arrays, axis=None, out=None, *, dtype=None, casting=None):
163163
"""
164164
concatenate(
165-
(a1, a2, ...),
166-
axis=0,
167-
out=None,
168-
dtype=None,
165+
(a1, a2, ...),
166+
axis=0,
167+
out=None,
168+
dtype=None,
169169
casting="same_kind"
170170
)
171171
@@ -1465,10 +1465,10 @@ def may_share_memory(a, b, max_work=None):
14651465
def is_busday(dates, weekmask=None, holidays=None, busdaycal=None, out=None):
14661466
"""
14671467
is_busday(
1468-
dates,
1469-
weekmask='1111100',
1470-
holidays=None,
1471-
busdaycal=None,
1468+
dates,
1469+
weekmask='1111100',
1470+
holidays=None,
1471+
busdaycal=None,
14721472
out=None
14731473
)
14741474
@@ -1527,12 +1527,12 @@ def busday_offset(dates, offsets, roll=None, weekmask=None, holidays=None,
15271527
busdaycal=None, out=None):
15281528
"""
15291529
busday_offset(
1530-
dates,
1531-
offsets,
1532-
roll='raise',
1533-
weekmask='1111100',
1534-
holidays=None,
1535-
busdaycal=None,
1530+
dates,
1531+
offsets,
1532+
roll='raise',
1533+
weekmask='1111100',
1534+
holidays=None,
1535+
busdaycal=None,
15361536
out=None
15371537
)
15381538
@@ -1631,11 +1631,11 @@ def busday_count(begindates, enddates, weekmask=None, holidays=None,
16311631
busdaycal=None, out=None):
16321632
"""
16331633
busday_count(
1634-
begindates,
1635-
enddates,
1636-
weekmask='1111100',
1637-
holidays=[],
1638-
busdaycal=None,
1634+
begindates,
1635+
enddates,
1636+
weekmask='1111100',
1637+
holidays=[],
1638+
busdaycal=None,
16391639
out=None
16401640
)
16411641
@@ -1715,7 +1715,7 @@ def datetime_as_string(arr, unit=None, timezone=None, casting=None):
17151715
arr : array_like of datetime64
17161716
The array of UTC timestamps to format.
17171717
unit : str
1718-
One of None, 'auto', or
1718+
One of None, 'auto', or
17191719
a :ref:`datetime unit <arrays.dtypes.dateunits>`.
17201720
timezone : {'naive', 'UTC', 'local'} or tzinfo
17211721
Timezone information to use when displaying the datetime. If 'UTC',

numpy/_core/numerictypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888

8989
# we add more at the bottom
9090
__all__ = [
91-
'ScalarType', 'typecodes', 'issubdtype', 'datetime_data',
92-
'datetime_as_string', 'busday_offset', 'busday_count',
91+
'ScalarType', 'typecodes', 'issubdtype', 'datetime_data',
92+
'datetime_as_string', 'busday_offset', 'busday_count',
9393
'is_busday', 'busdaycalendar', 'isdtype'
9494
]
9595

0 commit comments

Comments
 (0)